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: possible regression in go test outside of GOPATH #18778

Closed
dlsniper opened this issue Jan 24, 2017 · 6 comments
Closed

cmd/go: possible regression in go test outside of GOPATH #18778

dlsniper opened this issue Jan 24, 2017 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dlsniper
Copy link
Contributor

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

go version go1.8rc1 linux/amd64
go version go1.8rc2 windows/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/florin/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build127243291=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\go
set GORACE=
set GOROOT=C:\Go1.8
set GOTOOLDIR=C:\Go1.8\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

Run go test ./... in a folder containing Go files outside of GOPATH

What did you expect to see?

In Go 1.7 or below this used to work

What did you see instead?

The following error message:

can't load package: package ./.: non-canonical import path: "./." should be "."

I am currently conflicted if this is a regression or a bug fix but the error message is unclear.

Thank you

@bradfitz
Copy link
Contributor

To @rsc for cmd/go triage.

@bradfitz bradfitz added this to the Go1.9 milestone Jan 24, 2017
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 24, 2017
@bradfitz bradfitz changed the title Possible regression in go test outside of GOPATH cmd/go: possible regression in go test outside of GOPATH Jan 24, 2017
@vcabbage
Copy link
Member

Looks like the root directory matched by ./... becomes ./. here:

name := prefix + filepath.ToSlash(path)

Probably made no difference before https://golang.org/cl/31668/.
Sticking name = filepath.Clean(name) in after that line clears it up.

@dlsniper
Copy link
Contributor Author

@vcabbage thanks for doing the investigation. @rsc / @bradfitz since this is a regression in 1.8, do you think we could have this fixed in RC3?
I ask this because it already showed up for a few people while testing other things and I'm not sure if it's intended or not to be like this and then maybe at least a less intrusive change could be done by making the error message a bit more clear.

@ianlancetaylor
Copy link
Contributor

The docs seem pretty clear that "..." is used with GOPATH. I think it's an accident that it ever worked outside of GOPATH. go test ./... does seem to still work within GOPATH.

It's an easy fix, though. Sent CL 35646. @rsc can decide.

@gopherbot
Copy link

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

@dlsniper
Copy link
Contributor Author

dlsniper commented Jan 25, 2017

@ianlancetaylor I'd be happy if this remains as it is but we just have either a better error in this case and document this as a bug fix in the release notes. Thank you for your CL!

@bradfitz bradfitz modified the milestones: Go1.8Maybe, Go1.9 Jan 25, 2017
@golang golang locked and limited conversation to collaborators Jan 26, 2018
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants