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: list template Context is missing GOPATH #14547
Comments
Why not use go env GOPATH instead ?
|
I have two entries in GOPATH and was trying to see if fmt would give me only the first one, but then I hit this bug. Already went ahead to wrote the desired GOPATH manually. (Trying to avoid platform-dependency like piping to sed or some such.) |
Are you trying to determine which GOPATH entry the package was located in ? On Sun, 28 Feb 2016, 17:51 gima, notifications@github.com wrote:
|
Not quite, but the end result is the same. I was abusing go fmt to try and obtain a single path from GOPATH, because using $GOPATH without parsing would not work if there were multiple paths in it Specifically the first encountered path in GOPATH, because it's the path that go get downloads into. |
When you say "single GOPATH" do you mean the first element in GOPATH ?
|
Yes, the first element of GOPATH. |
If you need to do this in Go you can use If you need to do it in shell there are a few options depending on your On Sun, Feb 28, 2016 at 6:57 PM, gima notifications@github.com wrote:
|
Thank you. I know these; I was just, uh.., doing something stupid, probably. And thus I worked around it:
..I couldn't find what in-place-of $GOPATH would make the command the least platform-dependent (no grep, no sed, etc., as they wouldn't work in windows). Really, this is not a big deal, I just reported this template context -problem as there seemed to be a bug in the code. I feel bad to have taken your time and to have bothered you for this long, apologies. |
It's no problem. In the future consider asking questions like this in another forum. |
beep The original bug still exists. And you promoted this into a question, not me |
Someone please reopen and change the title to something like
I mailed CL 20010. @gima FYI, the GOPATH that list will output will have all components listed, so it won't help with your problem. |
CL https://golang.org/cl/20010 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
Investigation
I believe this to be the problem:
The
Context
struct for the template is constructed in context.go#L24 and assigned in list.go#L160, but the field GOPATH doesn't seem to be assigned.I'm not knownledgeable enough to know if this has some meaning, but it seems like a bug.
The text was updated successfully, but these errors were encountered: