Skip to content

Commit 9fd6bce

Browse files
authored
Merge pull request #1276 from crazy-max/go-vendor
chore: go mod vendor
2 parents 53e0a91 + 63e598c commit 9fd6bce

File tree

5,193 files changed

+1558094
-12
lines changed

Some content is hidden

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

5,193 files changed

+1558094
-12
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
99
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
1010
COPY --from=xx / /
1111
ENV CGO_ENABLED=0
12+
ENV GOFLAGS="-mod=vendor"
1213
RUN apk add --no-cache file git
1314
WORKDIR /src
1415

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: all
2+
all:
3+
4+
.PHONY: vendor
5+
vendor:
6+
$(eval $@_TMP_OUT := $(shell mktemp -d -t diun-output.XXXXXXXXXX))
7+
docker buildx bake --set "*.output=type=local,dest=$($@_TMP_OUT)" vendor
8+
rm -rf ./vendor
9+
cp -R "$($@_TMP_OUT)"/* ./
10+
rm -rf "$($@_TMP_OUT)"/*

hack/vendor.Dockerfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,43 @@ ARG ALPINE_VERSION="3.18"
55
ARG GOMOD_OUTDATED_VERSION="v0.8.0"
66

77
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
8-
RUN apk add --no-cache git linux-headers musl-dev
8+
ENV GOFLAGS="-mod=vendor"
9+
RUN apk add --no-cache git linux-headers musl-dev rsync
910
WORKDIR /src
1011

1112
FROM base AS vendored
12-
RUN --mount=type=bind,target=.,rw \
13-
--mount=type=cache,target=/go/pkg/mod <<EOT
13+
RUN --mount=target=/context \
14+
--mount=target=.,type=tmpfs \
15+
--mount=target=/go/pkg/mod,type=cache <<EOT
1416
set -e
17+
rsync -a /context/. .
1518
go mod tidy
16-
go mod download
19+
go mod vendor
1720
mkdir /out
18-
cp go.mod go.sum /out
21+
cp -r go.mod go.sum vendor /out
1922
EOT
2023

2124
FROM scratch AS update
2225
COPY --from=vendored /out /
2326

2427
FROM vendored AS validate
25-
RUN --mount=type=bind,target=.,rw <<EOT
28+
RUN --mount=target=/context \
29+
--mount=target=.,type=tmpfs <<EOT
2630
set -e
31+
rsync -a /context/. .
2732
git add -A
33+
rm -rf vendor
2834
cp -rf /out/* .
29-
diff=$(git status --porcelain -- go.mod go.sum)
30-
if [ -n "$diff" ]; then
31-
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
32-
echo "$diff"
35+
if [ -n "$(git status --porcelain -- go.mod go.sum vendor)" ]; then
36+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make vendor"'
37+
git status --porcelain -- go.mod go.sum vendor
3338
exit 1
3439
fi
3540
EOT
3641

3742
FROM psampaz/go-mod-outdated:${GOMOD_OUTDATED_VERSION} AS go-mod-outdated
3843
FROM base AS outdated
39-
RUN --mount=type=bind,target=. \
44+
RUN --mount=type=bind,target=.,rw \
4045
--mount=type=cache,target=/go/pkg/mod \
4146
--mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \
42-
go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct
47+
go list -mod=mod -u -m -json all | go-mod-outdated -update -direct

vendor/github.com/AlecAivazis/survey/v2/CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/AlecAivazis/survey/v2/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)