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
It appears that go fmt attempts to download all module dependencies if they aren't present. However, as far as I can tell, there is no reason for go fmt to do this, since it doesn't process dependencies at all; it just changes the formatting of a single file (or a group of files).
At a minimum, go fmt should obey GOFLAGS=-mod=readonly, but I think even when that's not present, it shouldn't attempt to download dependencies.
This came up in practice on the Boulder project, where we vendor our dependencies and run tests inside a container that does not have Internet access. One of those tests is a check for correct formatting with go fmt.
The text was updated successfully, but these errors were encountered:
go version go1.12 linux/amd64
go env
OutputWhat did you do?
Create a tiny package using modules:
foo.go
go.mod
Clear the module cache:
Disconnect from the Internet.
Run
go fmt
:What did you expect to see?
A successful run of
go fmt
.What did you see instead?
An error message.
It appears that
go fmt
attempts to download all module dependencies if they aren't present. However, as far as I can tell, there is no reason forgo fmt
to do this, since it doesn't process dependencies at all; it just changes the formatting of a single file (or a group of files).At a minimum,
go fmt
should obeyGOFLAGS=-mod=readonly
, but I think even when that's not present, it shouldn't attempt to download dependencies.This came up in practice on the Boulder project, where we vendor our dependencies and run tests inside a container that does not have Internet access. One of those tests is a check for correct formatting with
go fmt
.The text was updated successfully, but these errors were encountered: