Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.10.1 linux/amd64 vgo:2018-02-20.1
Specifically vgo
is as of 5db81b5cd6ab5ee1dd1b1b0ee0843f194ab7b908
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/myitcv/.mountpoints/x"
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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=/tmp/go-build749051986=/tmp/go-build -gno-record-gcc-switches"
VGOMODROOT=""
What did you do?
Everything works just fine with vgo
:
cd `mktemp -d`
export GOPATH=$PWD
mkdir blah
cd blah/
echo 'module "rubbish.com/blah"' >> go.mod
echo 'package blah
import _ "myitcv.io/blah2"
' >> blah.go
vgo build
works fine and gives the output:
vgo: resolving import "myitcv.io/blah2"
vgo: finding myitcv.io/blah2 (latest)
vgo: adding myitcv.io/blah2 v0.0.0-20180407140204-f591dcc2d6822ecafa384190ef45f5c333f4f82d
vgo: finding myitcv.io/blah2 v0.0.0-20180407140204-f591dcc2d6822ecafa384190ef45f5c333f4f82d
vgo: downloading myitcv.io/blah2 v0.0.0-20180407140204-f591dcc2d6822ecafa384190ef45f5c333f4f82d
But with old go get
:
cd `mktemp -d`
export GOPATH=$PWD
go get myitcv.io/blah2
What did you expect to see?
Success.
What did you see instead?
package myitcv.io/blah2: unrecognized import path "myitcv.io/blah2" (parse https://myitcv.io/blah2?go-get=1: multiple meta tags match import path "myitcv.io/blah2")
It was my understanding that the mod
VCS meta go-import
should be able to co-exist with the current git
(or equivalent) ones in order that a package can be go get
-able as well as vgo
-compatible. E.g.:
$ curl https://myitcv.io/blah2?go-get=1
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="myitcv.io git https://github.com/myitcv/x">
<meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">
<meta name="go-source" content="myitcv.io https://github.com/myitcv/x/wiki https://github.com/myitcv/x/tree/master{/dir} https://github.com/myitcv/x/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/myitcv.io/blah2">
</head>
<body>
Redirecting to docs at <a href="https://godoc.org/myitcv.io/blah2">godoc.org/myitcv.io/blah2</a>...
</body>
</html>
But old go get
doesn't ignore unknown VCS's, and so the two meta tags "clash".
Or have I got this wrong?
If I have got this wrong, how can a repo support both?
As a side note, the corresponding test for matchGoImport
looks a bit suspicious; it doesn't actually assert that the actual error (when there is one) matches the error we want; there are a number of mismatches in the expectations vs the actual result. And there is also no expectation for this scenario of multiple matches.