-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.modules
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.22.0 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/jimmy/.cache/go-build' GOENV='/home/jimmy/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/jimmy/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/jimmy/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.22.0' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/home/jimmy/code/autoreadme/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build368045690=/tmp/go-build -gno-record-gcc-switches' uname -sr: Linux 6.6.15-amd64 Distributor ID: Debian Description: Debian GNU/Linux trixie/sid Release: n/a Codename: trixie /lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.37-18) stable release version 2.37. gdb --version: GNU gdb (Debian 13.2-1+b1) 13.2
What did you do?
https://go.dev/play/p/n_SQJPM3hh1
What did you expect to see?
I expected ParseLax to record the toolchain as it is not an "unknown statement"
What did you see instead?
Using Parse, the toolchain info is recorded but, using ParseLax, 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 the toolchain 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
- change the documentation for
ParseLaxto specify that it will ignore known directives that are only applicable to main modules - change the implementation so
ParseLaxrecords known directives that are irrelevant to non-main modules
2 would be preferable in my case as I
- need info that's not included in
go mod edit -json - want everything that's known when a release is cut
- do not want to have to do a release whenever a new directive is added, as the new directive may not be important to my tool and, even if it is, I don't want to have to rush to support it
Metadata
Metadata
Assignees
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.modules