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: package fails to resolve from within external test package #26279

Closed
myitcv opened this issue Jul 8, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@myitcv
Copy link
Member

commented Jul 8, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64
vgo commit 8a71b2bd9c54c265c37322f928113c849582486b

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="/tmp/tmp.mLuCNaVLVO"
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build619975550=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello
vgo mod -init -module example.com/hello
mkdir blah
cd blah
cat <<EOD > blah_test.go
package blah_test

import (
        _ "example.com/hello/blah/other"
)
EOD
mkdir other
cd other
cat <<EOD > other.go
package other
EOD
cd ..
vgo list -test -json .

What did you expect to see?

JSON output with a zero exit code.

What did you see instead?

A non-zero exit code with the error message:

can't load test package: blah_test.go:4:9: unknown import path "example.com/hello/blah/other": no such package in module

This package does exist however:

$ vgo list example.com/hello/blah/other
example.com/hello/blah/other

@gopherbot gopherbot added this to the vgo milestone Jul 8, 2018

@myitcv

This comment has been minimized.

Copy link
Member Author

commented Jul 8, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2018

Well that's wrong. Reproduced.

@rsc rsc modified the milestones: vgo, Go1.11 Jul 12, 2018

@rsc rsc added the modules label Jul 12, 2018

@rsc rsc changed the title x/vgo: package fails to resolve from within external test package cmd/go: package fails to resolve from within external test package Jul 12, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Aug 8, 2018

Change https://golang.org/cl/128556 mentions this issue: cmd/go: add a test that reproduces #26279

@bcmills bcmills added the NeedsFix label Aug 8, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Aug 8, 2018

Change https://golang.org/cl/128636 mentions this issue: all: add module definitions

gopherbot pushed a commit to golang/build that referenced this issue Aug 8, 2018

all: add module definitions
I computed these using a build of the Go toolchain from a working copy at
https://golang.org/cl/128136, patchset 12.

The versions selected by 'go mod tidy' needed two tweaks to pass tests:
go get golang.org/x/text@master
go get github.com/russross/blackfriday@v1

The x/text version bump is because the last tagged version (v0.3.0) is very old
(last December).

The blackfriday bump is because the repository made a breaking change (v2.0.0)
without changing the import path.

With those changes, 'go test ./...' passes at the repo root.
('go test all' fails, possibly due to golang/go#26279.)

Updates golang/go#26279.
Updates golang/go#26872.

Change-Id: Ieac5327e4bddd2b78b981d7683beb98608708a3a
Reviewed-on: https://go-review.googlesource.com/128636
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented Aug 9, 2018

Change https://golang.org/cl/128358 mentions this issue: cmd/go: fix module loader and test-only dependencies

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.