x/mod/modfile: ParseLax and toolchain #67132
Labels
modules
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go.dev/play/p/n_SQJPM3hh1
What did you expect to see?
I expected
ParseLax
to record thetoolchain
as it is not an "unknown statement"What did you see instead?
Using
Parse
, thetoolchain
info is recorded but, usingParseLax
, it's ignored.I'm not sure if this is a problem with the code or documentation. The documentation states
ParseLax
is intended for non-main modules which do not need thetoolchain
directive, but it also implies that it should be identical to Parse except that an unknown directive in the go.mod does not cause an error.I see two valid fixes
ParseLax
to specify that it will ignore known directives that are only applicable to main modulesParseLax
records known directives that are irrelevant to non-main modules2 would be preferable in my case as I
go mod edit -json
The text was updated successfully, but these errors were encountered: