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
go:
- 1.11.x
- 1.12.x
# - 1.11.x
# - 1.12.x
- 1.13.x
- 1.14.x
@ -22,7 +22,7 @@ before_install:
install:
- 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
script:
@ -30,9 +30,9 @@ script:
case $TRAVIS_OS_NAME in
linux|osx)
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
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
- go test -race -coverprofile=coverage.txt -covermode=atomic -v

View File

@ -38,12 +38,12 @@ const (
_ = 1 << (10 * iota)
KiB // 1024
MiB // 1048576
//GiB // 1073741824
//TiB // 1099511627776 (超过了int32的范围)
//PiB // 1125899906842624
//EiB // 1152921504606846976
//ZiB // 1180591620717411303424 (超过了int64的范围)
//YiB // 1208925819614629174706176
// GiB // 1073741824
// TiB // 1099511627776 (超过了int32的范围)
// PiB // 1125899906842624
// EiB // 1152921504606846976
// ZiB // 1180591620717411303424 (超过了int64的范围)
// YiB // 1208925819614629174706176
)
const (
@ -192,6 +192,7 @@ func TestAntsPoolWithFuncGetWorkerFromCachePreMalloc(t *testing.T) {
//-------------------------------------------------------------------------------------------
// Contrast between goroutines without a pool and goroutines with ants pool.
//-------------------------------------------------------------------------------------------
func TestNoPool(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < n; i++ {