-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: list command modifies the go.mod file #34842
Comments
/cc @bcmills |
Duplicate of #34822 |
Wait, no. In this case there is a non-cosmetic change: the addition of the |
This is working as designed and documented. Per https://golang.org/cmd/go/#hdr-Maintaining_module_requirements:
|
The problem with such an approach is when the command is executed by tools, not the user. E.g. an editor or CI build can retrieve dependencies information using |
Do I understand correctly that missing go version will be added anyway after fix for #34822? |
Yes, the |
Incase it helps any intellij users dealing with multiple golang versions in the same project: I've been trying https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006485599-automatically-insert-system-s-go-version-in-go-mod-?page=1#community_comment_360001297500 as a workaround and it seems okay. Would be nice if either intellij had a way to specify a per-module golang sdk, or if But will keep searching for something to fill the gap as neatly as possible. |
This is weird. How come I have no control over |
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?
Executed the
go list -m -json all
command in github.com/sirupsen/logrus and https://github.com/go-yaml/yaml/ repositoriesWhat did you expect to see?
List of modules + unmodified go.mod files.
What did you see instead?
The go.mod files were modified, the
go 1.13
line was added in logrus and in the go-yamlwas changed to
The
go list
documentation doesn't mention that it changes go.mod files, imo it should not.The text was updated successfully, but these errors were encountered: