doc: clarify that godebug in go.mod is ignored when using a workspace in favor of go.work's godebug #72109
Labels
BugReport
Issues describing a possible bug in the Go implementation.
Documentation
Issues describing a change to documentation.
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
GoCommand
cmd/go
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Go version
1.23.6 and 1.24.0
Output of
go env
in your module/workspace:What did you do?
The
godebug
directives in thego.mod
file of the main package are ignored when using a workspace.I'm not sure if this is a bug or on purpose, but if it's on purpose I feel like it should be clearer in the documentation, and possibly warned explicitly when running a go command.
The following piece of sentence appears twice in the documentation https://go.dev/doc/godebug, but it's not clear to me that go.mod is ignored when using a go.work.
Reproducible example
Consider the following
main.go
, it prints the value of the godebug settingpanicnil
.Create a go.mod file with a
godebug
directive forpanicnil
:And a go.work without said directive:
Then run the code with and without workspace:
The directive in the go.mod file is ignored when using a workspace.
Alternatively using
go list
also shows the diff:What did you see happen?
The directive in the go.mod file is ignored when using a workspace.
What did you expect to see?
I expected the
godebug
directive in thego.mod
to be used, or in the worst case scenario a warning about it being ignored due to using a workspace.(or even just improve the documentation to make this case clear)
The text was updated successfully, but these errors were encountered: