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 test doesn't like long paths on Windows #10651

Closed
anforowicz opened this issue Apr 30, 2015 · 6 comments
Closed

cmd/go: go test doesn't like long paths on Windows #10651

anforowicz opened this issue Apr 30, 2015 · 6 comments

Comments

@anforowicz
Copy link

Expected behavior: go test works

Actual behavior: go test fails because it trips over long paths it itself constructs for building and running the tests

Output of "go version":
go version go1.4.2 windows/amd64

Repro steps:

C:\Users\lukasza\my\enlistment\has\rather\long\and\descriptive\paths\that\I\rather\like\and\enjoy>type foo\foo.go

package foo

func Foo() string {
return "foo"
}

C:\Users\lukasza\my\enlistment\has\rather\long\and\descriptive\paths\that\I\rather\like\and\enjoy>type foo\foo_test.go

package foo

import "testing"

func TestFoo(t *testing.T) {
t.Log("Testing foo")
}

C:\Users\lukasza\my\enlistment\has\rather\long\and\descriptive\paths\that\I\rather\like\and\enjoy>go test .\foo

/C/Users/lukasza/my/enlistment/has/rather/long/and/descriptive/paths/that/I/rather/like/and/enjoy/foo

mkdir C:\Users\lukasza\AppData\Local\Temp\go-build344025871_\C_\Users\lukasza\my\enlistment\has\rather\long\and\descriptive\paths\that\I\rather\like\and\enjoy
foo_test_\C_\Users\lukasza\my\enlistment\has\rather\long\and\descriptive\paths\that\I\rather: The filename or extension is too long.
FAIL /C/Users/lukasza/my/enlistment/has/rather/long/and/descriptive/paths/that/I/rather/like/and/enjoy/foo [setup failed]

@minux
Copy link
Member

minux commented Apr 30, 2015 via email

@alexbrainman
Copy link
Member

@anforowicz if you run "go test -x ..." command, you will see what go command does in full details - paths and all. All paths must be less then 260 characters on Windows, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx for details. Nothing we can do about the limitation. Just use shorter path in your GOPATH. Note how "go test" makes your path more then twice as long when it builds test source files, so really your paths should be less then 100 or something. Closing as unfortunate.

@minux I tried changing "go test" logic to use shorter paths in the past. It turned out too complicated, and I decided it is not worth the trouble.

Alex

@mikioh mikioh changed the title go test doesn't like long paths on Windows cmd/go: go test doesn't like long paths on Windows May 2, 2015
@vprus
Copy link

vprus commented Mar 14, 2016

I believe the statement that "All paths must be less than 260 characters... Nothing we can do" is not accurate. The same page explains how to use extended-lengths paths, which can be up to 32k in length. Is there a reason why go cannot use them?

@ianlancetaylor
Copy link
Contributor

@vprus I think that extended length paths use a different prefix (?) so I think that Go will use them if the user specifies such a prefix. I don't think Go should introduce them.

This is best discussed on the golang-dev mailing list, not on this closed issue. Please take any discussion to that list. Thanks.

@minux
Copy link
Member

minux commented Mar 14, 2016 via email

@alexbrainman
Copy link
Member

The same page explains how to use extended-lengths paths, which can be up to 32k in length. Is there a reason why go cannot use them?

I have found some standard Windows API's do not work with "long paths". For example, see my reply here #10577 (comment)

Alex

@golang golang locked and limited conversation to collaborators Mar 14, 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

6 participants