-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Bump minimal go version to 1.21.0 - Run rekres - Deprecate `context.RecvWithContext`. Remove it in the next version. - Deprecate `slices`. Move stuff that doesn't exist in `slices` yet to `xslices`. - Remove `xsync`. Only one update in `runtime` is required. - Add `ensure` package that provides wrappers function results wrappers that panics on error. - Add `must` package that does pretty much the same for tests. - Add `check` package that provides a set functions for table-driven tests. Signed-off-by: Dmitriy Matrenichev <[email protected]>
- Loading branch information
Showing
20 changed files
with
541 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# syntax = docker/dockerfile-upstream:1.5.2-labs | ||
# syntax = docker/dockerfile-upstream:1.6.0-labs | ||
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2023-05-11T13:47:02Z by kres latest. | ||
# Generated on 2023-08-21T16:35:57Z by kres latest. | ||
|
||
ARG TOOLCHAIN | ||
|
||
# cleaned up specs and compiled versions | ||
FROM scratch AS generate | ||
|
||
# runs markdownlint | ||
FROM docker.io/node:20.1.0-alpine3.17 AS lint-markdown | ||
FROM docker.io/node:20.5.1-alpine3.18 AS lint-markdown | ||
WORKDIR /src | ||
RUN npm i -g markdownlint-cli@0.34.0 | ||
RUN npm i -g markdownlint-cli@0.35.0 | ||
RUN npm i [email protected] | ||
COPY .markdownlint.json . | ||
COPY ./README.md ./README.md | ||
|
@@ -27,38 +27,45 @@ FROM --platform=${BUILDPLATFORM} toolchain AS tools | |
ENV GO111MODULE on | ||
ARG CGO_ENABLED | ||
ENV CGO_ENABLED ${CGO_ENABLED} | ||
ARG GOTOOLCHAIN | ||
ENV GOTOOLCHAIN ${GOTOOLCHAIN} | ||
ARG GOEXPERIMENT | ||
ENV GOEXPERIMENT ${GOEXPERIMENT} | ||
ENV GOPATH /go | ||
ARG DEEPCOPY_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ | ||
&& mv /go/bin/deep-copy /bin/deep-copy | ||
ARG GOLANGCILINT_VERSION | ||
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} \ | ||
&& mv /go/bin/golangci-lint /bin/golangci-lint | ||
ARG GOFUMPT_VERSION | ||
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ | ||
&& mv /go/bin/gofumpt /bin/gofumpt | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \ | ||
&& mv /go/bin/govulncheck /bin/govulncheck | ||
ARG GOIMPORTS_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \ | ||
&& mv /go/bin/goimports /bin/goimports | ||
ARG DEEPCOPY_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ | ||
&& mv /go/bin/deep-copy /bin/deep-copy | ||
ARG GOFUMPT_VERSION | ||
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \ | ||
&& mv /go/bin/gofumpt /bin/gofumpt | ||
|
||
# tools and sources | ||
FROM tools AS base | ||
WORKDIR /src | ||
COPY ./go.mod . | ||
COPY ./go.sum . | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
RUN cd . | ||
RUN --mount=type=cache,target=/go/pkg go mod download | ||
RUN --mount=type=cache,target=/go/pkg go mod verify | ||
COPY ./channel ./channel | ||
COPY ./containers ./containers | ||
COPY ./ensure ./ensure | ||
COPY ./maps ./maps | ||
COPY ./optional ./optional | ||
COPY ./pair ./pair | ||
COPY ./slices ./slices | ||
COPY ./value ./value | ||
COPY ./xerrors ./xerrors | ||
COPY ./xsync ./xsync | ||
COPY ./xslices ./xslices | ||
COPY ./xtesting ./xtesting | ||
RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null | ||
|
||
# runs gofumpt | ||
|
@@ -67,28 +74,32 @@ RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is no | |
|
||
# runs goimports | ||
FROM base AS lint-goimports | ||
RUN FILES="$(goimports -l -local github.com/siderolabs/gen .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/gen .':\n${FILES}"; exit 1) | ||
RUN FILES="$(goimports -l -local github.com/siderolabs/gen/ .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/gen/ .':\n${FILES}"; exit 1) | ||
|
||
# runs golangci-lint | ||
FROM base AS lint-golangci-lint | ||
WORKDIR /src | ||
COPY .golangci.yml . | ||
ENV GOGC 50 | ||
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 | ||
|
||
# runs govulncheck | ||
FROM base AS lint-govulncheck | ||
WORKDIR /src | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./... | ||
|
||
# runs unit-tests with race detector | ||
FROM base AS unit-tests-race | ||
WORKDIR /src | ||
ARG TESTPKGS | ||
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} | ||
|
||
# runs unit-tests | ||
FROM base AS unit-tests-run | ||
WORKDIR /src | ||
ARG TESTPKGS | ||
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} | ||
|
||
FROM scratch AS unit-tests | ||
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt | ||
COPY --from=unit-tests-run /src/coverage.txt /coverage-unit-tests.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.