golang/go

cmd/go: do not allow the main module to replace (to or from) itself

Open

#34,417 opened on Sep 19, 2019

View on GitHub
 (24 comments) (3 reactions) (0 assignees)Go (19,008 forks)batch import
GoCommandNeedsFixhelp wantedmodules

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

What version of Go are you using (go version)?

This problem is also seen on Linux using go1.12.3

And on Mac with the tip branch

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

What did you do?

Option A:

$ git clone https://github.com/rselph-tibco/go-unstable-mods.git
$ cd go-unstable-mods
$ git checkout start_here
$ git switch -c new_branch
$ ./run.sh

The git repository will be updated with the results of each step. Optionally, comment out the git commands to simply produce the error without recording results along the way.

This is equivalent to:

  1. Start with the contents of the attached file go-unstable-mods-start_here.tar.gz
  2. Set GOPATH and GOCACHE to point at empty directories
  3. From the sample1 directory run go mod tidy
  4. From the sample2 directory run go mod tidy
  5. From the sample2 directory run go install ./...
  6. From the sample1 directory run go install ./...
  7. Repeat the last step indefinitely

At this point, sample1/go.mod will never stabilize.

What did you expect to see?

go.mod should stabilize when the build is given the same inputs over and over.

What did you see instead?

go.mod eventually oscillates between two states, preventing -mod readonly from ever working, and wreaking havoc with source control.

Contributor guide