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: fix go get for paths ending with .go #14923

Closed
henvic opened this issue Mar 23, 2016 · 8 comments
Closed

cmd/go: fix go get for paths ending with .go #14923

henvic opened this issue Mar 23, 2016 · 8 comments

Comments

@henvic
Copy link
Contributor

henvic commented Mar 23, 2016

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/henvic/projects/gocode"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6/libexec/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?
    Tried to clone github.com/launchpad-project/api.go with:
    go get github.com/launchpad-project/api.go
  2. What did you expect to see?
    Expected go get to work as intended.
  3. What did you see instead?
    stat error (not found).

I have written and sent a one-line patch to https://go-review.googlesource.com/#/c/20893/1

This affects gojp/goreportcard#90 as well.

@ianlancetaylor
Copy link
Contributor

That is kind of a terrible name for that directory. It's confusing to use because the package name does not match the directory name. But I guess I can't think of a reason that the go tool should not support it.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 23, 2016
@minux
Copy link
Member

minux commented Mar 23, 2016 via email

@gopherbot
Copy link

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

@davecheney
Copy link
Contributor

I agree with @minux there is already enough confusion around go build and go test supporting .go files vs the recommend use of packages. To allow the go tool to fetch a package that has a directory named something.go will just add more confusion to an area newcomers already find difficult.

The clincher for me is package something.go is not a valid package declaration, so the name of directory cannot match the packages' name.

I vote to close this as unfortunate.

@henvic
Copy link
Contributor Author

henvic commented Mar 24, 2016

@minux,

I don't get your concerns about go build with such paths. Can't go just check if the path is a file or a directory?

My package is not the only one I have found ending in .go. I can very well rename it to have the .golang suffix (or any other name) and avoid this issue. But what about the several packages out there with the same issue (and future ones that will run into it eventually)?

I agree that the name of the package is not good, but go tools failing inconsistently due to directories with the .go suffix without being noisy about it is worse imho.

Reference: gojp/goreportcard#90

@henvic
Copy link
Contributor Author

henvic commented Mar 24, 2016

What about adding info to the docs that directories should never end with .go and / or failing noisy when it happens for the know reasons?

@henvic
Copy link
Contributor Author

henvic commented Mar 24, 2016

Or, better yet, explaining that projects / package directories should always use valid package names...

@henvic
Copy link
Contributor Author

henvic commented May 20, 2016

Blocked on Code-Review Label
https://go-review.googlesource.com/#/c/20893/

@henvic henvic closed this as completed May 20, 2016
@golang golang locked and limited conversation to collaborators May 20, 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

5 participants