-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This migrates automaxprocs to Go modules, keeping the old glide.yaml in place to provide constraints to legacy ecosystems. Using Go modules here significantly simplifies the Makefile.
- Loading branch information
Showing
8 changed files
with
139 additions
and
84 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,7 @@ _testmain.go | |
*.out | ||
*.log | ||
coverage.txt | ||
|
||
/bin | ||
cover.out | ||
cover.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
language: go | ||
sudo: false | ||
go: | ||
- 1.11.x | ||
- 1.12.x | ||
go_import_path: go.uber.org/automaxprocs | ||
cache: | ||
directories: | ||
- vendor | ||
|
||
env: | ||
global: | ||
- GO111MODULE=on | ||
|
||
matrix: | ||
include: | ||
- go: "1.12.x" | ||
- go: "1.13.x" | ||
env: LINT=1 | ||
|
||
install: | ||
- make dependencies | ||
- make install | ||
|
||
script: | ||
- make ci | ||
- test -z "$LINT" || make lint | ||
- make test | ||
|
||
after_success: | ||
- make cover | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,46 @@ | ||
PKGS ?= $(shell glide nv) | ||
PKG_FILES ?= *.go | ||
|
||
# The linting tools evolve with each Go version, so run them only on the latest | ||
# stable release. | ||
GO_VERSION := $(shell go version | cut -d " " -f 3) | ||
GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) | ||
LINTABLE_MINOR_VERSIONS := 12 | ||
ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) | ||
SHOULD_LINT := true | ||
endif | ||
|
||
.PHONY: dependencies | ||
dependencies: | ||
@echo "Installing Glide and locked dependencies..." | ||
glide --version || go get -u -f github.com/Masterminds/glide | ||
glide install | ||
ifdef SHOULD_LINT | ||
@echo "Installing golint..." | ||
go get -u golang.org/x/lint/golint | ||
else | ||
@echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION) | ||
endif | ||
export GOBIN ?= $(shell pwd)/bin | ||
|
||
GO_FILES := $(shell \ | ||
find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ | ||
-o -name '*.go' -print | cut -b3-) | ||
|
||
GOLINT = $(GOBIN)/golint | ||
STATICCHECK = $(GOBIN)/staticcheck | ||
|
||
.PHONY: build | ||
build: | ||
go build ./... | ||
|
||
.PHONY: install | ||
install: | ||
go mod download | ||
|
||
.PHONY: test | ||
test: | ||
@.build/test.sh | ||
go test -race ./... | ||
|
||
# Disable printf-like invocation checking due to testify.assert.Error() | ||
VET_RULES := -printf=false | ||
.PHONY: cover | ||
cover: | ||
go test -coverprofile=cover.out -covermode=atomic -coverpkg=./... ./... | ||
go tool cover -html=cover.out -o cover.html | ||
|
||
$(GOLINT): | ||
go install golang.org/x/lint/golint | ||
|
||
$(STATICCHECK): | ||
go install honnef.co/go/tools/cmd/staticcheck | ||
|
||
.PHONY: lint | ||
lint: | ||
ifdef SHOULD_LINT | ||
lint: $(GOLINT) $(STATICCHECK) | ||
@rm -rf lint.log | ||
@echo "Checking formatting..." | ||
@gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log | ||
@echo "Installing test dependencies..." | ||
@go test -i $(PKGS) | ||
@echo "Checking vet..." | ||
@echo "Checking gofmt" | ||
@gofmt -d -s $(GO_FILES) 2>&1 | tee lint.log | ||
@echo "Checking go vet" | ||
@go vet ./... 2>&1 | tee -a lint.log | ||
@echo "Checking lint..." | ||
@$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) | ||
@echo "Checking for unresolved FIXMEs..." | ||
@git grep -i fixme | grep -v -e vendor -e Makefile -e .md | tee -a lint.log | ||
@echo "Checking golint" | ||
@$(GOLINT) ./... | tee -a lint.log | ||
@echo "Checking staticcheck" | ||
@$(STATICCHECK) ./... 2>&1 | tee -a lint.log | ||
@echo "Checking for license headers..." | ||
@DRY_RUN=1 .build/check_license.sh | tee -a lint.log | ||
@./.build/check_license.sh | tee -a lint.log | ||
@[ ! -s lint.log ] | ||
else | ||
@echo "Skipping linters on" $(GO_VERSION) | ||
endif | ||
|
||
.PHONY: ci | ||
ci: SHELL := /bin/bash | ||
ci: test lint | ||
bash <(curl -s https://codecov.io/bash) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module go.uber.org/automaxprocs | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/stretchr/testify v1.4.0 | ||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f | ||
honnef.co/go/tools v0.0.1-2019.2.3 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= | ||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= | ||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | ||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | ||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= | ||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= | ||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= | ||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= | ||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | ||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f h1:kDxGY2VmgABOe55qheT/TFqUMtcTHnomIPS1iv3G4Ms= | ||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= | ||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= | ||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2020 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
// +build tools | ||
|
||
package automaxprocs | ||
|
||
import ( | ||
// Tools we use during development. | ||
_ "golang.org/x/lint/golint" | ||
_ "honnef.co/go/tools/cmd/staticcheck" | ||
) |