-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
Description
What version of Go are you using (go version)?
$ go version go version go1.17.2 linux/amd64
Does this issue reproduce with the latest release?
This is 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/fishy/.cache/go-build" GOENV="/home/fishy/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/fishy/.gopath/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/fishy/.gopath" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/nix/store/vydvhfg076dfchm93hn96li2k1jqh04n-go-1.17.2/share/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/nix/store/vydvhfg076dfchm93hn96li2k1jqh04n-go-1.17.2/share/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.2" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/fishy/work/test-go-mod-retract/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3897776340=/tmp/go-build -gno-record-gcc-switches"
What did you do?
This is forked from the discussion of #34055 and is an issue currently affecting Apache Thrift.
I made a minimal reproducible example at https://github.com/fishy/test-go-mod-retract to demonstrate the issue, but the high level summary is:
- The project made a mistake by adding
go.modto a subdirectory, without realizing the consequences of that. - The project realized that's a mistake, removed the
go.modin the subdirectory and addedgo.modto the root directory instead. - The action in 2 doesn't fix the issue totally. the version with
go.modunder the subdirectory will be recognized by go toolchain (and pkg.go.dev site) as the "latest" version, over whatever git semver tag you tagged at the project later (for example, if you go to https://pkg.go.dev/github.com/apache/[email protected]/lib/go/thrift, it will tell you that it's not the "latest" version). - Even if you try to retract that version from root
go.modfile, it won't work (as I demonstrated in the test-go-mod-retract repo).
What did you expect to see?
Either:
- We are able to retract a version from a previous, subdirectory
go.modfile, from the rootgo.modfile
or
- Provide a way to retract the whole
go.modfile (e.g. we can add the subdirectorygo.modsaying "every previous version coming out of thisgo.modfile are retracted and this go.mod file should be ignored")
What did you see instead?
The consequences of the mistake of adding subdirectory go.mod file lasts forever with no way to fix completely.