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: go run -mod=mod [files...]
does not update go.mod and go.sum
#52331
Comments
This is intentional from CL 339170 |
Thank you for notifying the change is intentional, and the pointer for CL. Let me clarify the behaviors of
|
CC @matloob. |
I don't think it is — at least, that was not my intent during code review. 😅 If |
wouldn't that leave it in an inconsistent or non reproducible state compared to |
Yes, it would leave the module untidy — but lots of things (like |
I can reproduce this is a standalone |
|
@gopherbot, please backport to Go 1.18. This is a regression in the behavior of |
Backport issue(s) opened: #52468 (for 1.18). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/401536 mentions this issue: |
Change https://go.dev/cl/404094 mentions this issue: |
…ter loading the command-line-arguments package This entrypoint was missed in CL 349600, and the behavior happened not to be covered by existing tests. Updates #52331. Fixes #52468. Change-Id: Iccf12e8e633215abe4bfa1c3ca2fe3a8391b5ba5 Reviewed-on: https://go-review.googlesource.com/c/go/+/401536 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> (cherry picked from commit cf69725) Reviewed-on: https://go-review.googlesource.com/c/go/+/404094 Reviewed-by: David Chase <drchase@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, reproducible with 1.18.1.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
main.go
go.mod
No
go.sum
file.Execute
go run -mod=mod main.go
.What did you expect to see?
go run -mod=mod main.go
runs the code and update the dependency togo.mod
andgo.sum
, just likego run -mod=mod .
.This is the behavior of Go 1.17.9.
What did you see instead?
go run -mod=mod main.go
resolves the packagegolang.org/x/sys/unix
, and runs the code, but does not add the dependency togo.mod
. The filego.sum
is not created.Alternatively if this is an intended behavior, document in Go Modules Reference that even with
-mod=mod
,go run [files...]
does not updatego.mod
andgo.sum
, whilego run .
does.The text was updated successfully, but these errors were encountered: