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
Invocations of git to attempt to update the dependency modules. go fmt appears to always update imported modules with git, and does not have any way to only autoformat the local files.
Other go commands such as build or install can avoid the git overhead with -mod vendor, but fmt doesn't support the -mod argument. As a result packages which are fully vendored can be built, but not formatted without a working internet connection and/or git client.
The text was updated successfully, but these errors were encountered:
As an aside, have you considered using gofmt instead? It's a lower-level tool that works on files and directories; go fmt calls it under the hood. It doesn't understand package patterns like ./... or foo.com/bar, but usually a developer is formatting code near the current directory.
This is not to say that gofmt is a better tool, but if you want to format files without ever touching the module cache, it seems like the right tool for you.
@mvdan I'm using gofmt on individual files by necessity for now (this came up in the context of trying to bootstrap go module's git requirements into github.com/driusan/dgit, so go's "git" invocations aren't reliable for me because what I'm trying to do is get them to be reliable..)
@bcmills sorry, I did a search but missed that one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Inside of a go module, run
go fmt -x
What did you expect to see?
Invocations of
gofmt
to format the code.What did you see instead?
Invocations of
git
to attempt to update the dependency modules.go fmt
appears to always update imported modules withgit
, and does not have any way to only autoformat the local files.Other
go
commands such asbuild
orinstall
can avoid the git overhead with-mod vendor
, butfmt
doesn't support the-mod
argument. As a result packages which are fully vendored can be built, but not formatted without a working internet connection and/or git client.The text was updated successfully, but these errors were encountered: