The bug was originally discovered with using Go 1.17.5 while we were trying to setup a CI for our Go project.
It is also reproducible with the latest release and build, such as:
go version devel go1.19-8542bd8938 Thu May 19 19:32:35 2022 +0000 darwin/amd64
What did you do?
Go to any of your Go projects: cd $GOPATH/src/github.com/foo/bar
Make sure you have modules enabled: export GO111MODULE=on
Make sure you have vendor flag enabled: export GOFLAGS="-mod=vendor"
Make sure there is no vendor directory there: rm -rf vendor or if you have rename it mv vendor backup_vendor.
Run go fmt ./...
What did you expect to see?
I would expect to get an error:
go: open $GOPATH/src/github.com/foo/bar/vendor/modules.txt: no such file or directory
What did you see instead?
firstname.lastname@example.org: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
(skip the rest of them for brevity)
To ignore the vendor directory, use -mod=readonly or -mod=mod.
To sync the vendor directory, run:
go mod vendor
It complains about my modules (actually, for every single one of them) that are not in-sync with my vendors, but this comparison never happens in the first place since there's no vendor/modules.txt to compare with.
The text was updated successfully, but these errors were encountered: