Skip to content

refactor: go mod download for caching tools - #152

Merged
ninoseki merged 1 commit into
mainfrom
go-mod-download-in-ci
Oct 27, 2026
Merged

ninoseki merged 1 commit into
mainfrom
go-mod-download-in-ci

Conversation

@ninoseki

Copy link
Copy Markdown
Collaborator

A follow up PR for #151.

Caching for go tool doesn't work in CI:

> Run actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e
...
Cache restored successfully
Cache restored from key: setup-go-Linux-x64-ubuntu24-go-1.27.3-6a36259117d6437b71a58905c3aa6b0393ef1250d6165645ca35c91b1819bfb2
...

> Run go tool golangci-lint run
go: downloading github.com/golangci/golangci-lint/v2 v2.15.0
go: downloading charm.land/lipgloss/v2 v2.0.6
go: downloading github.com/gofrs/flock v0.13.1
...

(Cache hits and restored but go tool ... starts downloading)

Doing go mod download beforehand fixes the issue.

The go mod download command is useful mainly for pre-filling the module cache or for loading data to be served by a module proxy.

--- https://go.dev/ref/mod#go-mod-download

> Run actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e
...
Cache restored successfully
Cache restored from key: setup-go-Linux-x64-ubuntu24-go-1.27.3-6a36259117d6437b71a58905c3aa6b0393ef1250d6165645ca35c91b1819bfb2
go version go1.27.3 linux/amd64

> Run go mod download
  go mod download

> Run go tool golangci-lint run
  go tool golangci-lint run
  ...
0 issues.

(No downloading happens)

@ninoseki
ninoseki requested review from cdnsyseng and fw42 October 27, 2026 08:33
@ninoseki
ninoseki merged commit 14a7f40 into main Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants