From aead1bf1e3434a911d7b63ff2e113d75141c7923 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Wed, 15 Feb 2023 15:02:34 -0500 Subject: [PATCH 1/2] ci: bump to Go 1.20 & improve linting * Use Go 1.20 & 1.19 in CI (1.18 is now EOL) * `go.mod` now targets 1.19 - in the future, this should be safe to raise to the higher version as we use the new `-compat` flag properly * Update to latest golangci-lint * Move linting to happen as part of test job to ensure that it runs across the matrix of Go & OS versions, as some lint issues can be Go version or OS/platform specific * Upgrade `distribution/v3` to latest Signed-off-by: Milas Bowman --- .github/workflows/ci.yml | 9 +++++---- ci/Dockerfile | 4 ++-- go.mod | 6 +++--- go.sum | 8 ++++---- types/types_test.go | 1 + 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aeeb7e1d..4d777797 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Lint code - uses: golangci/golangci-lint-action@v2 - name: Check license run: DOCKER_BUILDKIT=1 make check-license - name: Check schema @@ -22,10 +20,10 @@ jobs: test: strategy: matrix: - go-version: ['1.18', '1.19'] + go-version: ['1.20', '1.19'] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} - timeout-minutes: 5 + timeout-minutes: 10 steps: - name: Checkout code uses: actions/checkout@v3 @@ -35,5 +33,8 @@ jobs: go-version: ${{ matrix.go-version }} check-latest: true cache: true + - uses: golangci/golangci-lint-action@v3 + with: + version: v1.51.1 - name: Test run: go test ./... diff --git a/ci/Dockerfile b/ci/Dockerfile index 8340233a..5dc44a36 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.18 +FROM golang:1.20 WORKDIR /go/src -ARG GOLANGCILINT_VERSION=v1.46.2 +ARG GOLANGCILINT_VERSION=v1.51.1 RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCILINT_VERSION} RUN go install github.com/kunalkushwaha/ltag@latest && rm -rf /go/src/github.com/kunalkushwaha diff --git a/go.mod b/go.mod index 75e9a6e8..4dd2671d 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/compose-spec/compose-go -go 1.18 +go 1.19 require ( - github.com/distribution/distribution/v3 v3.0.0-20221103125252-ebfa2a0ac0a9 + github.com/distribution/distribution/v3 v3.0.0-20230214150026-36d8c594d7aa github.com/docker/go-connections v0.4.0 github.com/docker/go-units v0.5.0 github.com/google/go-cmp v0.5.9 @@ -25,6 +25,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect + golang.org/x/sys v0.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 8fe5f04c..a850b73c 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/distribution/distribution/v3 v3.0.0-20221103125252-ebfa2a0ac0a9 h1:doprs/RuXCuN864IfxC3h2qocrt158wGv3A5mcqSZQw= -github.com/distribution/distribution/v3 v3.0.0-20221103125252-ebfa2a0ac0a9/go.mod h1:6rIc5NMSjXjjnwzWWy3HAm9gDBu+X7aCzL8VrHIKgxM= +github.com/distribution/distribution/v3 v3.0.0-20230214150026-36d8c594d7aa h1:L9Ay/slwQ4ERSPaurC+TVkZrM0K98GNrEEo1En3e8as= +github.com/distribution/distribution/v3 v3.0.0-20230214150026-36d8c594d7aa/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -58,8 +58,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/types/types_test.go b/types/types_test.go index 2d7f283e..3d9a7416 100644 --- a/types/types_test.go +++ b/types/types_test.go @@ -313,6 +313,7 @@ func TestMarshalServiceEntrypoint(t *testing.T) { } for _, tc := range tcs { + tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() From 2f0d4ab5b9d4fb148a8008390f1ca3b564b42c9b Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Wed, 15 Feb 2023 15:16:05 -0500 Subject: [PATCH 2/2] ci: increase timeout for Windows runner Signed-off-by: Milas Bowman --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d777797..41008d37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,5 +36,6 @@ jobs: - uses: golangci/golangci-lint-action@v3 with: version: v1.51.1 + args: --timeout 5m - name: Test run: go test ./...