Upgrade golangci-lint and format some code

This commit is contained in:
Andy Pan 2020-07-05 00:04:47 +08:00
parent 4d9057a8d0
commit 678f39767e
2 changed files with 12 additions and 11 deletions

View File

@ -8,8 +8,8 @@ os:
dist: bionic dist: bionic
go: go:
- 1.11.x # - 1.11.x
- 1.12.x # - 1.12.x
- 1.13.x - 1.13.x
- 1.14.x - 1.14.x
@ -22,7 +22,7 @@ before_install:
install: install:
- go get -u golang.org/x/lint/golint - go get -u golang.org/x/lint/golint
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0 - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0
- curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ~/bin - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ~/bin
script: script:
@ -30,9 +30,9 @@ script:
case $TRAVIS_OS_NAME in case $TRAVIS_OS_NAME in
linux|osx) linux|osx)
golint ./... | reviewdog -f=golint -reporter=github-check golint ./... | reviewdog -f=golint -reporter=github-check
golangci-lint run --out-format=line-number -E gofmt -E golint -E misspell -E lll | reviewdog -f=golangci-lint -reporter=github-check golangci-lint run --out-format=line-number -E goimports -E misspell -E godot -E lll | reviewdog -f=golangci-lint -reporter=github-check
golint ./... | reviewdog -f=golint -reporter=github-pr-review golint ./... | reviewdog -f=golint -reporter=github-pr-review
golangci-lint run --out-format=line-number -E gofmt -E golint -E misspell -E lll | reviewdog -f=golangci-lint -reporter=github-pr-review golangci-lint run --out-format=line-number -E goimports -E misspell -E godot -E lll | reviewdog -f=golangci-lint -reporter=github-pr-review
;; ;;
esac esac
- go test -race -coverprofile=coverage.txt -covermode=atomic -v - go test -race -coverprofile=coverage.txt -covermode=atomic -v

View File

@ -192,6 +192,7 @@ func TestAntsPoolWithFuncGetWorkerFromCachePreMalloc(t *testing.T) {
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
// Contrast between goroutines without a pool and goroutines with ants pool. // Contrast between goroutines without a pool and goroutines with ants pool.
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
func TestNoPool(t *testing.T) { func TestNoPool(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < n; i++ { for i := 0; i < n; i++ {