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: match go-import package prefixes by slash #15947

Closed
smcquay opened this issue Jun 2, 2016 · 2 comments
Closed

cmd/go: match go-import package prefixes by slash #15947

smcquay opened this issue Jun 2, 2016 · 2 comments
Milestone

Comments

@smcquay
Copy link
Contributor

smcquay commented Jun 2, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version go1.6.2 darwin/amd64

  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sm"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?

I am hosting the following information over https:

curl https://go.mcquay.me/?go-get=1                                                                                                                        
<!DOCTYPE html>
<html><head>
<meta name="go-import" content="go.mcquay.me/sm/fooa git https://s.mcquay.me/sm/ud">
<meta name="go-import" content="go.mcquay.me/sm/foob git https://s.mcquay.me/sm/ud">
<meta name="go-import" content="go.mcquay.me/sm/fooaa git https://s.mcquay.me/sm/ud">
</head>
<body><p>go tool metadata in head</p></body>
</html>

and when I point the go tool at it, the following work:

go get -x go.mcquay.me/sm/fooa
go get -x go.mcquay.me/sm/foob

But this fails:

go get -x go.mcquay.me/sm/fooaa
package go.mcquay.me/sm/fooaa: unrecognized import path "go.mcquay.me/sm/fooaa" (parse https://go.mcquay.me/sm/fooaa?go-get=1: multiple meta tags match import path "go.mcquay.me/sm/fooaa")
  1. What did you expect to see?

I'd expect that these are separate repositories and can be used to build and emit different pkg/bins. I'd expect the go tool to install it correctly.

  1. What did you see instead?

go get failed with message:

package go.mcquay.me/sm/fooaa: unrecognized import path "go.mcquay.me/sm/fooaa" (parse https://go.mcquay.me/sm/fooaa?go-get=1: multiple meta tags match import path "go.mcquay.me/sm/fooaa")

I can appreciate that the go tool can't clone a repo into a folder that's already a repo. The check on:

https://github.com/golang/go/blob/master/src/cmd/go/vcs.go#L782

seems a bit aggressive. Perhaps it just needs to be relaxed and test substrings on '/' boundaries?

@adg adg changed the title go tool will not install packages with common prefix cmd/go: match go-import package prefixes by slash Jun 3, 2016
@adg
Copy link
Contributor

adg commented Jun 3, 2016

I agree with the suggestion, it should just test on slash boundaries.

@ianlancetaylor ianlancetaylor added this to the Go1.8 milestone Jun 3, 2016
@smcquay
Copy link
Contributor Author

smcquay commented Jun 3, 2016

CL https://golang.org/cl/23732 mentions this issue.

dmmcquay pushed a commit to dmmcquay/vain that referenced this issue Jan 14, 2017
the go tool currenty has a pathology where it mistakingly claims it
can't clone a repo because it checks prefix by bytes, not by splitting
the path on slash.

Once golang/go#15947 comes out (go1.8) then go
tools will be able to handle being provided with valid but overlapping
packages.

For now though we'll just return meta for the requested package.

Change-Id: Ie5026e7d5c1377ff7d2c2140b21f9b745af69764
@golang golang locked and limited conversation to collaborators Jun 3, 2017
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

4 participants