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: Windows 10 causes "GOPATH entry is relative" error due to extraneous semicolon #21928

Closed
oliverjanik opened this issue Sep 19, 2017 · 15 comments
Labels
ExpertNeeded FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@oliverjanik
Copy link

Please answer these questions before submitting your issue. Thanks!

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

1.9

Does this issue reproduce with the latest release?

yes, freshly downloaded windows installer

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

Windows 10 64 bit

What did you do?

C:\Users\Oliver>go env
go: GOPATH entry is relative; must be absolute path: "".
For more details see: 'go help gopath'

C:\Users\Oliver>echo %GOPATH%
C:\gopath;D:\work;D:\temp;

What did you expect to see?

normal go env output

What did you see instead?

an error

The issue seems to be the trailing semicolon. However that is what the env variable dialog in win 10 produces and I think go should deal with it.

image

@davecheney
Copy link
Contributor

davecheney commented Sep 19, 2017 via email

@oliverjanik
Copy link
Author

Yes I'm sure. Should be easy to replicate for anyone with Win 10.

@davecheney
Copy link
Contributor

davecheney commented Sep 19, 2017 via email

@as
Copy link
Contributor

as commented Sep 19, 2017

It's application specific, Windows does not enforce or follow a standard. Here's part of my %Path% on windows right now:

C:\Users\as\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Docker Toolbox

@davecheney
Copy link
Contributor

cc @cznic @alexbrainman I know we've had the discussion before about filepath.SplitList and filepath.JoinList and I know part of that discussion dealt with empty path elements.

@davecheney davecheney added ExpertNeeded NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 19, 2017
@alexbrainman
Copy link
Member

I can reproduce the issue on my Windows 10. And I agree that we should fix it.

On unix terminating a PATH list with a : is very bad as it
is sometimes interpreted as "."

Windows always check your current directory first even before looking at the PATH.

But we are talking about GOPATH here. I think we should ignore blank elements of GOPATH. We should ignore elements consisting of spaces only. What do you think?

Alex

@mdempsky mdempsky changed the title GOPATH entry is relative; must be absolute path: "". cmd/go: Windows 10 causes "GOPATH entry is relative" error due to extraneous semicolon Sep 19, 2017
@davecheney
Copy link
Contributor

davecheney commented Sep 19, 2017

@alexbrainman yes, you're right. I think

  • we should ignore empty path elements "" , ie. %GOPATH%=C:\go;
  • we should not ignore blank path elements, " ", ie. %GOPATH= ;D:\Go

@alexbrainman
Copy link
Member

@davecheney I do not see how path elements like " " are different from "". What do you propose to do with path elements like " "?

Alex

@davecheney
Copy link
Contributor

davecheney commented Sep 20, 2017 via email

@mattn
Copy link
Member

mattn commented Sep 20, 2017

I think the both should be ignored as below works. path-list is candidates for the PATHs.

C:\>set PATH=; ;%PATH%

C:\>some-command.exe

@davecheney
Copy link
Contributor

davecheney commented Sep 20, 2017 via email

@alexbrainman
Copy link
Member

" " is a mistake.

SGTM. Thanks for explaining.

Alex

@gopherbot
Copy link

Change https://golang.org/cl/65151 mentions this issue: cmd/go: ignore empty path elements in GOPATH

@AndrewWPhillips
Copy link

Workaround: In Windows 10 control panel "Edit environment variable" dialog select the "Edit text..." button and delete the trailing semicolon. (Took me a while to work out how to do this so I thought others might like to know.)

@rhelenagh
Copy link

Thanks!

@golang golang locked and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ExpertNeeded FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

8 participants