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?
Edit: edited original issue to make it not depend on myitcv.io/...
packages.
cd `mktemp -d`
echo 'module "rubbish.com"' > go.mod
# make blah submodule
mkdir blah
cd blah
echo 'module "rubbish.com/blah"' > go.mod
# create skeleton implementation that depends on external code
cat <<EOD > blah.go
package blah
import _ "rsc.io/pdf"
EOD
vgo build
which gives the expected output:
vgo: resolving import "rsc.io/pdf"
vgo: finding rsc.io/pdf (latest)
vgo: adding rsc.io/pdf v0.0.0-20180112171046-225057252246
vgo: finding rsc.io/pdf v0.0.0-20180112171046-225057252246
vgo: downloading rsc.io/pdf v0.0.0-20180112171046-225057252246
We can also vgo list
as expected:
vgo list -f "{{printf \"%#v\" .Module}}" .
vgo list -f "{{printf \"%#v\" .Module}}" rubbish.com/blah
gives the expected:
modinfo.ModulePublic{Top:true, Path:"rubbish.com/blah", Version:""}
modinfo.ModulePublic{Top:true, Path:"rubbish.com/blah", Version:""}
But then if we move to the parent (?) module and vgo list
:
cd ..
vgo list .
we get the possibly-to-be expected:
vgo: import "rubbish.com" [/tmp/tmp.Q8I5ISBSzQ]: no Go source files
(although I think you could argue that a module doesn't need to contain source files, it can just contain other modules?)
But then if we:
vgo list ./...
we get:
vgo: resolving import "rsc.io/pdf"
vgo: finding rsc.io/pdf (latest)
vgo: adding rsc.io/pdf v0.0.0-20180112171046-225057252246
rubbish.com/blah
The last line is fine, but the resolving of "rsc.io/pdf"
is unexpected because that requirement only exists for the submodule (we are currently in top module directory).
The "rubbish.com"
go.mod
file has also been modified:
$ cat go.mod
module "rubbish.com"
require "rsc.io/pdf" v0.0.0-20180112171046-225057252246
which is unexpected.
What did you expect to see?
- The root
go.mod
file to be untouched - No resolving required when doing
vgo list ./...
at the top module level
What did you see instead?
Per above.