Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: replace directive for "latest" is replaced with latest version #34044

Closed
jameshartig opened this issue Sep 3, 2019 · 2 comments
Closed

Comments

@jameshartig
Copy link
Contributor

jameshartig commented Sep 3, 2019

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

$ go version 1.13

Does this issue reproduce with the latest release?

Yes

What did you do?

  1. Added:
    replace gerrit.levenlabs.com/ctxtime => gerrit.levenlabs.com/ctxtime latest
    to my go.mod file.
  2. Run go get

What did you expect to see?

I expected it to leave latest in replace line so that the latest version is always fetched when go get is run. Ideally we can commit latest and when CI runs and calls go get it'll always get the latest version of this particular module (which is an internal/private module). Additionally, when developers run go get they also get the latest version of that module and when they run go get -u the go.mod file won't be changed to remove the latest directive.

What did you see instead?

When go mod tidy or go get is run, the latest is replaced with the latest version at that time.

@katiehockman katiehockman changed the title Module replace line with "latest" is replaced with version cmd/go: replace directive for "latest" is replaced with latest version Sep 3, 2019
@katiehockman
Copy link
Contributor

This is intentional behavior as described in https://golang.org/cmd/go/#hdr-The_go_mod_file. It's important that go.mod files only have versions in semver form to have reproducible builds for other modules that may depend on it.

@katiehockman
Copy link
Contributor

I also recommend checking out https://github.com/golang/go/wiki/Questions (and specifically the #modules slack).

@golang golang locked and limited conversation to collaborators Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants