Skip to content

Commit 772e67f

Browse files
authored
Merge pull request #1146 from starius/go-mod-fix
ci: fix mod-check
2 parents 859ba45 + 4b8bdfd commit 772e67f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ GOBUILD := CGO_ENABLED=0 GO111MODULE=on go build -v
1515
GOINSTALL := CGO_ENABLED=0 GO111MODULE=on go install -v
1616
GOMOD := GO111MODULE=on go mod
1717

18+
# GitLab-backed module sources can reject CI runner traffic. Seed GitLab and
19+
# modernc.org modules through the public Go proxy before the direct check.
20+
MOD_CHECK_FILES := go.mod go.sum swapserverrpc/go.mod swapserverrpc/go.sum \
21+
looprpc/go.mod looprpc/go.sum tools/go.mod tools/go.sum
22+
MOD_CHECK_PREFETCH := $(shell awk '($$1 ~ /^(gitlab\.com\/|modernc\.org\/)/) { \
23+
version=$$2; sub("/go.mod$$", "", version); \
24+
if (version ~ /^v/) print $$1 "@" version; \
25+
}' $(MOD_CHECK_FILES) | sort -u)
26+
1827
COMMIT := $(shell git describe --abbrev=40 --dirty --tags)
1928
COMMIT_HASH := $(shell git rev-parse HEAD)
2029
DIRTY := $(shell git diff-index --quiet HEAD -- || echo dirty)
@@ -156,6 +165,9 @@ mod-tidy:
156165

157166
mod-check:
158167
@$(call print, "Checking modules.")
168+
ifneq ($(MOD_CHECK_PREFETCH),)
169+
@GOPROXY=https://proxy.golang.org $(GOMOD) download $(MOD_CHECK_PREFETCH)
170+
endif
159171
GOPROXY=direct $(GOMOD) tidy
160172
cd swapserverrpc/ && GOPROXY=direct $(GOMOD) tidy
161173
cd looprpc/ && GOPROXY=direct $(GOMOD) tidy

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ require (
206206
golang.org/x/tools v0.39.0 // indirect
207207
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
208208
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
209-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
209+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217
210210
gopkg.in/errgo.v1 v1.0.1 // indirect
211211
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
212212
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)