From 12adeca2d0b9fcc6ab207b4c10c68dec323bcff4 Mon Sep 17 00:00:00 2001 From: Tam Mach Date: Tue, 18 Aug 2020 23:06:17 +1000 Subject: [PATCH] build(golang1.15): Upgrade to golang 1.15 for smaller binary Golang 1.15 comes to few improvements, one of them is to have smaller binary. This PR is to make golang 1.15 as default version in CI, I also update Docker based image to golang:1.15* as well. Two issues faced with golang 1.15: - Conflict between -v in `golangci-lint` and `go test`. Update to --verbose to avoid the same. - `nolintlint_unused.go` testdata is not matching regex. Correct by adding one space after // [1]: https://github.com/golang/go/issues/40763 Signed-off-by: Tam Mach --- .github/workflows/pr.yml | 7 ++++--- .github/workflows/tag.yml | 2 +- build/Dockerfile | 2 +- build/Dockerfile.alpine | 2 +- test/enabled_linters_test.go | 2 +- test/testdata/nolintlint_unused.go | 6 +++--- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 141c990e6728..6311caa774f4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,7 +26,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.14 # test only the latest go version to speed up CI + go-version: 1.15 # test only the latest go version to speed up CI - name: Run tests run: make.exe test continue-on-error: true @@ -38,7 +38,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.14 # test only the latest go version to speed up CI + go-version: 1.15 # test only the latest go version to speed up CI - name: Run tests run: make test continue-on-error: true @@ -50,6 +50,7 @@ jobs: golang: - 1.13 - 1.14 + - 1.15 steps: - uses: actions/checkout@v2 - name: Install Go @@ -77,6 +78,6 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: 1.15 - name: Check generated files are up to date run: make fast_check_generated diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 2ef7e44bd8d2..ed70cc6fa13e 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -14,7 +14,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: 1.15 - name: Unshallow run: git fetch --prune --unshallow - name: Login do docker.io diff --git a/build/Dockerfile b/build/Dockerfile index 834a06103f6b..2bee70587c61 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14 +FROM golang:1.15 # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume COPY golangci-lint /usr/bin/ diff --git a/build/Dockerfile.alpine b/build/Dockerfile.alpine index 61067b141d4d..b9c34e0a4386 100644 --- a/build/Dockerfile.alpine +++ b/build/Dockerfile.alpine @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine +FROM golang:1.15-alpine # gcc is required to support cgo; # git and mercurial are needed most times for go get`, etc. diff --git a/test/enabled_linters_test.go b/test/enabled_linters_test.go index 702df9be7f1d..70cb4ffc47c2 100644 --- a/test/enabled_linters_test.go +++ b/test/enabled_linters_test.go @@ -176,7 +176,7 @@ func TestEnabledLinters(t *testing.T) { t.Run(c.name, func(t *testing.T) { t.Parallel() - runArgs := []string{"-v"} + runArgs := []string{"--verbose"} if !c.noImplicitFast { runArgs = append(runArgs, "--fast") } diff --git a/test/testdata/nolintlint_unused.go b/test/testdata/nolintlint_unused.go index 184a2116892f..f9d7b41f235a 100644 --- a/test/testdata/nolintlint_unused.go +++ b/test/testdata/nolintlint_unused.go @@ -5,7 +5,7 @@ package testdata import "fmt" func Foo() { - fmt.Println("unused") //nolint // ERROR "directive `//nolint .*` is unused" - fmt.Println("unused,specific") //nolint:varcheck // ERROR "directive `//nolint:varcheck .*` is unused for linter varcheck" - fmt.Println("not run") //nolint:unparam // unparam is not run so this is ok + fmt.Println("unused") // nolint // ERROR "directive `//nolint .*` is unused" + fmt.Println("unused,specific") // nolint:varcheck // ERROR "directive `//nolint:varcheck .*` is unused for linter varcheck" + fmt.Println("not run") // nolint:unparam // unparam is not run so this is ok }