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: "go get\alexbrainman\gowingui" should succeed on Mac #24233

alexbrainman opened this issue Mar 4, 2018 · 4 comments


Copy link

@alexbrainman alexbrainman commented Mar 4, 2018

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

go version go1.10 windows/amd64

Does this issue reproduce with the latest release?


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

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Alex\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\users\alex\dev
set GOROOT=c:\users\alex\dev\go
set GOTOOLDIR=c:\users\alex\dev\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_CFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Alex\AppData\Local\Temp\go-build838310042=/tmp/go-build -gno-record-gcc-switches

What did you do?

I run

go get\alexbrainman\gowingui


What did you expect to see?

I expected command to fail, because I used \ instead of / in package import path.

What did you see instead?

I see no error message, and I also see gowingui.exe in my %GOPATH%\bin directory.


I discovered this while investigating #24232

And if I run

go install -ldflags "-H windowsgui"\alexbrainman\gowingui

the %GOPATH%\bin\gowingui.exe file does not have IMAGE_SUBSYSTEM_WINDOWS_GUI flag set properly.

So if this issue is rejected as working as intended, than we should fix cmd/go flag processing to avoid cases like #24232


Copy link

@ysmolsky ysmolsky commented Mar 4, 2018


C:\Users\thorn>go get -v\alexbrainman\gowingui (download)


thorn@t2 ...go/src/playground % go get -v '\alexbrainman\gowingui'
https fetch failed: parse\alexbrainman\gowingui: invalid character "\\" in host name

This happens in ImportPathsNoDotExpansion function

which is called by downloadPaths:

On windows go get silently fixes \ into / which is the right thing, but as a side effect, it applies the same fix to URLs. Which again could be a good thing because Chrome browser does exactly the same thing.

There is an inconsistency in behaviour between OSes with fileseparator = \ and other Oses. I don't know if it should be fixed.

@bradfitz bradfitz added this to the Go1.11 milestone Mar 4, 2018
Copy link

@bradfitz bradfitz commented Mar 4, 2018

I'm pretty sure we should fix this, but marking it as needs decision just in case. @ianlancetaylor, @rsc?

Copy link

@rsc rsc commented Mar 26, 2018

I agree.

@spf13 spf13 added the NeedsFix label Mar 26, 2018
@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 2, 2018
Copy link

@bcmills bcmills commented Oct 24, 2018

The fact that the backslashes work on Windows is intentional and not actually Windows-specific:

// Arguments are supposed to be import paths, but
// as a courtesy to Windows developers, rewrite \ to /
// in command-line arguments. Handles .\... and so on.
if filepath.Separator == '\\' {
a = strings.ReplaceAll(a, `\`, `/`)

We should figure out why they don't work on macOS.

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Oct 24, 2018
@bcmills bcmills changed the title cmd/go: "go get\alexbrainman\gowingui" should fail cmd/go: "go get\alexbrainman\gowingui" should succeed on Mac Oct 24, 2018
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants