You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split the `x509/` package into smaller files, previously it was 1500
lines monolith with different methods and types mixed together, split it
so it's mostly one type per file (or closely related files). I added
a couple of unit-tests, but no code changes.
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
FROM --platform=${BUILDPLATFORM} ${TOOLCHAIN} AS toolchain
@@ -32,12 +32,12 @@ ARG GOEXPERIMENT
32
32
ENV GOEXPERIMENT=${GOEXPERIMENT}
33
33
ENV GOPATH=/go
34
34
ARG DEEPCOPY_VERSION
35
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
35
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
36
36
&& mv /go/bin/deep-copy /bin/deep-copy
37
37
ARG GOLANGCILINT_VERSION
38
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
38
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
39
39
&& mv /go/bin/golangci-lint /bin/golangci-lint
40
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \
40
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \
41
41
&& mv /go/bin/govulncheck /bin/govulncheck
42
42
ARG GOFUMPT_VERSION
43
43
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
@@ -49,11 +49,11 @@ WORKDIR /src
49
49
COPY go.mod go.mod
50
50
COPY go.sum go.sum
51
51
RUN cd .
52
-
RUN --mount=type=cache,target=/go/pkg go mod download
53
-
RUN --mount=type=cache,target=/go/pkg go mod verify
52
+
RUN --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go mod download
53
+
RUN --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go mod verify
54
54
COPY ./tls ./tls
55
55
COPY ./x509 ./x509
56
-
RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null
56
+
RUN --mount=type=cache,target=/go/pkg,id=crypto/go/pkg go list -mod=readonly all >/dev/null
57
57
58
58
# runs gofumpt
59
59
FROM base AS lint-gofumpt
@@ -64,25 +64,24 @@ FROM base AS lint-golangci-lint
64
64
WORKDIR /src
65
65
COPY .golangci.yml .
66
66
ENV GOGC=50
67
-
RUN golangci-lint config verify --config .golangci.yml
68
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml
67
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint,id=crypto/root/.cache/golangci-lint,sharing=locked --mount=type=cache,target=/go/pkg,id=crypto/go/pkg golangci-lint run --config .golangci.yml
69
68
70
69
# runs govulncheck
71
70
FROM base AS lint-govulncheck
72
71
WORKDIR /src
73
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./...
72
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg govulncheck ./...
74
73
75
74
# runs unit-tests with race detector
76
75
FROM base AS unit-tests-race
77
76
WORKDIR /src
78
77
ARG TESTPKGS
79
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp CGO_ENABLED=1 go test -v -race -count 1 ${TESTPKGS}
78
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg --mount=type=cache,target=/tmp,id=crypto/tmp CGO_ENABLED=1 go test -v -race -count 1 ${TESTPKGS}
80
79
81
80
# runs unit-tests
82
81
FROM base AS unit-tests-run
83
82
WORKDIR /src
84
83
ARG TESTPKGS
85
-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}
84
+
RUN --mount=type=cache,target=/root/.cache/go-build,id=crypto/root/.cache/go-build --mount=type=cache,target=/go/pkg,id=crypto/go/pkg --mount=type=cache,target=/tmp,id=crypto/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}
0 commit comments