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: mod tidy replaces non-semver strings non-friendly ones #32883

Closed
cpuguy83 opened this issue Jul 1, 2019 · 9 comments

Comments

Projects
None yet
5 participants
@cpuguy83
Copy link

commented Jul 1, 2019

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

$ go version
go version go1.12.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="~/go/bin"
GOCACHE="/Users/cpuguy83/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/cpuguy83/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.6/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/cpuguy83/dev/vk/virtual-kubelet/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/h0/019q23y92j58nhjw33nyjd1h0000gn/T/go-build763891092=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Run go mod tidy with custom/non-semver tags

What did you expect to see?

Still be able to tell what tag was put there

What did you see instead?

It replaces it with semi-gibberish.

Would be nice if it at least put the tag string in a comment.

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

Have you tried this with the 1.13 beta? Can you share a way to reproduce this issue, or at least show the before and after of go.mod?

@cpuguy83

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

Before:

module fake_module

go 1.12

require (
	github.com/gogo/protobuf v1.2.1 // indirect
	k8s.io/api kubernetes-1.13.7
	k8s.io/apimachinery v0.0.0-20190629125103-05b5762916b3 // indirect
)

After:

module fake_module

go 1.12

require (
	github.com/gogo/protobuf v1.2.1 // indirect
	k8s.io/api v0.0.0-20190222213804-5cb15d344471
	k8s.io/apimachinery v0.0.0-20190629125103-05b5762916b3 // indirect
)

See the k8s.io/api line.

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

I assume this is because it's not following the vX.Y.Z tag format. I'm on the phone at the moment, but I'm pretty sure the modules docs can tell you what the restrictions around tag names are.

@cpuguy83

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

Yes, that's exactly why. My point is that the replacement is unfriendly.
As I mentioned, it could at least put the replaced tag name in a comment, or even as an extension to the format itself.

@cpuguy83

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

Also yes, go1.13 behaves the same way as expected.

@thepudds

This comment has been minimized.

Copy link

commented Jul 3, 2019

Some related discussion in #25898.

@thepudds

This comment has been minimized.

Copy link

commented Jul 3, 2019

Also, a little more context on the current behavior is in https://golang.org/cmd/go/#hdr-Module_queries :

A fully-specified semantic version, such as "v1.2.3", evaluates to that specific version.
...
A revision identifier for the underlying source repository, such as a commit hash prefix, revision tag, or branch name, selects that specific code revision. If the revision is also tagged with a semantic version, the query evaluates to that semantic version. Otherwise the query evaluates to a pseudo-version for the commit.

... where the last sentence in that quote is what’s happening in your example I think.

(Pseudo-versions are an important part of the system. They include a timestamp and a commit hash, and they allow a total ordering across versions recorded in go.mod and make it easier to reason about which recorded versions are considered "later" than another recorded version).

@cpuguy83

This comment has been minimized.

Copy link
Author

commented Jul 3, 2019

Yes, I'm posting this issue because this is a poor user experience.

@ALTree ALTree changed the title go mod tidy replaces non-semver strings non-friendly ones cmd/go: mod tidy replaces non-semver strings non-friendly ones Jul 6, 2019

@jayconrod jayconrod modified the milestones: Go1.14, Unplanned Jul 9, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Duplicate of #25898

@bcmills bcmills marked this as a duplicate of #25898 Jul 18, 2019

@bcmills bcmills closed this Jul 18, 2019

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