Skip to content

cmd/go mishandles build metadata separator #28647

Closed
@mellis

Description

@mellis

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

$ go version
go version go1.11 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=""
GOCACHE="/Users/micellis/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/micellis/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/5n/cs1hx8q170v2741s2whxhc10pnl463/T/go-build108446644=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go get example.com/foo/bar@v1.0.0+meta.sha256

Note the build metadata is not ignored when attempting to retrieve the info file.

What did you expect to see?

go: finding example.com/foo/bar v1.0.0
go: finding example.com/foo v1.0.0
go: finding example.com v1.0.0
go get example.com/foo/bar@v1.0.0+meta: unexpected status (http://localhost:8000/example.com/foo/bar/@v/v1.0.0.info): 404 File not found

What did you see instead?

go: finding example.com/foo/bar v1.0.0+meta.sha256
go: finding example.com/foo v1.0.0+meta.sha256
go: finding example.com v1.0.0+meta.sha256
go get example.com/foo/bar@v1.0.0+meta.sha256: unexpected status (http://localhost:8000/example.com/foo/bar/@v/v1.0.0+meta.sha256.info): 404 File not found

Activity

mellis

mellis commented on Nov 7, 2018

@mellis
ContributorAuthor

The issue is due to the internal/semver/semver.go package not recognizing the separator character '.' in the parseBuild function.

Have a small fix, just want to confirm this isn't expected (doesn't appear to be looking at the function and similar function parsePrerelease)

gopherbot

gopherbot commented on Nov 12, 2018

@gopherbot
Contributor

Change https://golang.org/cl/148835 mentions this issue: cmd/go: Fix parsing multiple build metadata

added
NeedsFixThe path to resolution is known, but the work has not been done.
on Nov 19, 2018
added this to the Go1.12 milestone on Nov 19, 2018
added a commit that references this issue on Nov 21, 2018
dcb1363
thepudds

thepudds commented on May 14, 2019

@thepudds
Member

@mellis The behavior here changed again recently in #31713.

It would be interesting to hear if you now see behavior that works for you if try tip. (An easy way to get tip is go get golang.org/dl/gotip && gotip download).

Also, did you have an example of a public repository where this was a problem, or was it a private repo where you first saw this as a problem?

mellis

mellis commented on May 14, 2019

@mellis
ContributorAuthor

I originally noticed the behaviour when experimenting with module support for our internal repositories and build system.

We've changed strategies since then though, so this particular issue isn't affecting us any more.

locked and limited conversation to collaborators on May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mellis@bcmills@gopherbot@thepudds

        Issue actions

          cmd/go mishandles build metadata separator · Issue #28647 · golang/go