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
fastest963 opened this issue Sep 3, 2019 · 2 comments
Closed

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

fastest963 opened this issue Sep 3, 2019 · 2 comments
Labels

Comments

@fastest963
Copy link
Contributor

@fastest963 fastest963 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

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Sep 3, 2019

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

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Sep 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.