Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 95d9fbd

Browse files
authored
Merge pull request #2220 from milas/go-1.19
build: upgrade to Go 1.19 & build tweaks
2 parents 7a57a33 + 90324a5 commit 95d9fbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+304
-288
lines changed

.github/workflows/aci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: 1.18
10+
GO_VERSION: 1.19
1111

1212
jobs:
1313
check-optional-tests:

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: 1.18
10+
GO_VERSION: 1.19
1111

1212
jobs:
1313
lint:
@@ -30,7 +30,7 @@ jobs:
3030
env:
3131
BUILD_TAGS: kube,e2e
3232
run: |
33-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.45.2
33+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.50.1
3434
make -f builder.Makefile lint
3535
3636
# only on main branch, costs too much for the gain on every PR

.github/workflows/cli-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
default: 'true'
1313

1414
env:
15-
GO_VERSION: 1.18
15+
GO_VERSION: 1.19
1616

1717
jobs:
1818
release:

.github/workflows/ecs-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: 1.18
10+
GO_VERSION: 1.19
1111

1212
jobs:
1313
check-optional-tests:

.github/workflows/kube-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: 1.18
10+
GO_VERSION: 1.19
1111

1212
jobs:
1313
check-optional-tests:

.github/workflows/windows-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: 1.18
10+
GO_VERSION: 1.19
1111

1212
jobs:
1313
check-optional-tests:

.golangci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,28 @@ linters:
66
enable-all: false
77
disable-all: true
88
enable:
9-
- deadcode
109
- errcheck
1110
- gocyclo
1211
- gofmt
1312
- goimports
14-
- revive
1513
- gosimple
1614
- govet
1715
- ineffassign
1816
- lll
1917
- misspell
2018
- nakedret
2119
- staticcheck
22-
- structcheck
2320
- typecheck
2421
- unconvert
2522
- unparam
2623
- unused
27-
- varcheck
2824
linters-settings:
2925
gocyclo:
3026
min-complexity: 16
3127
lll:
3228
line-length: 200
29+
goimports:
30+
local-prefixes: github.com/docker/compose-cli
3331
issues:
3432
# golangci hides some golint warnings (the warning about exported things
3533
# withtout documentation for example), this will make it show them anyway.

Dockerfile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# syntax=docker/dockerfile:1.2
2-
1+
# syntax=docker/dockerfile:1
32

43
# Copyright 2020 Docker Compose CLI authors
54

@@ -15,8 +14,8 @@
1514
# See the License for the specific language governing permissions and
1615
# limitations under the License.
1716

18-
ARG GO_VERSION=1.18-alpine
19-
ARG GOLANGCI_LINT_VERSION=v1.45.2-alpine
17+
ARG GO_VERSION=1.19-alpine
18+
ARG GOLANGCI_LINT_VERSION=v1.50.1-alpine
2019
ARG PROTOC_GEN_GO_VERSION=v1.5.2
2120

2221
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base
@@ -43,7 +42,7 @@ FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS lint-base
4342
FROM base AS lint
4443
ENV GOFLAGS="-buildvcs=false"
4544
ENV CGO_ENABLED=0
46-
COPY --from=lint-base /usr/bin/golangci-lint /usr/bin/golangci-lint
45+
COPY --from=lint-base --link /usr/bin/golangci-lint /usr/bin/golangci-lint
4746
ARG BUILD_TAGS
4847
ARG GIT_TAG
4948
RUN --mount=target=. \
@@ -89,13 +88,13 @@ RUN --mount=target=. \
8988
make BINARY=/out/docker -f builder.Makefile cross
9089

9190
FROM scratch AS protos
92-
COPY --from=make-protos /compose-cli/cli/server/protos .
91+
COPY --from=make-protos --link /compose-cli/cli/server/protos .
9392

9493
FROM scratch AS cli
95-
COPY --from=make-cli /out/* .
94+
COPY --from=make-cli --link /out/* .
9695

9796
FROM scratch AS cross
98-
COPY --from=make-cross /out/* .
97+
COPY --from=make-cross --link /out/* .
9998

10099
FROM base AS test
101100
ENV CGO_ENABLED=0
@@ -120,9 +119,11 @@ RUN --mount=type=cache,target=/go/pkg/mod \
120119
go mod tidy
121120

122121
FROM scratch AS go-mod-tidy
123-
COPY --from=make-go-mod-tidy /compose-cli/go.mod .
124-
COPY --from=make-go-mod-tidy /compose-cli/go.sum .
122+
COPY --from=make-go-mod-tidy --link /compose-cli/go.mod .
123+
COPY --from=make-go-mod-tidy --link /compose-cli/go.sum .
125124

126125
FROM base AS check-go-mod
127126
COPY . .
128-
RUN make -f builder.Makefile check-go-mod
127+
RUN --mount=type=cache,target=/go/pkg/mod \
128+
--mount=type=cache,target=/root/.cache/go-build \
129+
make -f builder.Makefile check-go-mod

aci/backend_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ import (
2323
"github.com/stretchr/testify/mock"
2424
"gotest.tools/v3/assert"
2525

26+
"golang.org/x/oauth2"
27+
2628
"github.com/docker/compose-cli/aci/login"
2729
"github.com/docker/compose-cli/api/containers"
28-
"golang.org/x/oauth2"
2930
)
3031

3132
func TestGetContainerName(t *testing.T) {

aci/compose.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ import (
2222
"net/http"
2323

2424
"github.com/compose-spec/compose-go/types"
25-
"github.com/docker/compose-cli/utils"
2625
"github.com/docker/compose/v2/pkg/api"
2726
"github.com/docker/compose/v2/pkg/progress"
2827
"github.com/sirupsen/logrus"
2928

29+
"github.com/docker/compose-cli/utils"
30+
3031
"github.com/docker/compose-cli/aci/convert"
3132
"github.com/docker/compose-cli/aci/login"
3233
"github.com/docker/compose-cli/api/context/store"

0 commit comments

Comments
 (0)