-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Comments
Sounds like a syscall.Mkdir bug, or a known limitation of windows API.
let @alexbrainman to decide.
|
@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 |
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? |
@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. |
This has been discussed in the past, but the problem is
we can't automatically use long paths without duplicating
a lot of win32 path handling logic into the runtime (or syscall,
os) package.
See
https://blogs.msdn.microsoft.com/bclteam/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton/
for more explanations.
|
I have found some standard Windows API's do not work with "long paths". For example, see my reply here #10577 (comment) Alex |
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]
The text was updated successfully, but these errors were encountered: