Skip to content

DOS shell can't handle deep directory structures with go test #6300

Closed
@gopherbot

Description

@gopherbot

by dean.w.schulze:

1.  Create a package and a test for the package in a deep directory structure (for me
this happens with 127 character path)
2.  Run "go test" in that directory from the DOS prompt

What is the expected output?
Success or failure from the go test

What do you see instead?
An error from DOS indicating that the temporary directory structure is too deep.

Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?
Windows 7 Pro 64-bit

Which version are you using?  (run 'go version')
go version go1.1.2 windows/amd64

Please provide any additional information below.

Here is my command line and the output:

c:\dean\courses\algorithms-stanford\design.and.analysis.of.algorithms.1\programm
ing-questions\common\code\golang\src\algoutils>go test
# _/c_/dean/courses/algorithms-stanford/design.and.analysis.of.algorithms.1/prog
ramming-questions/common/code/golang/src/algoutils
mkdir C:\Users\dean\AppData\Local\Temp\go-build651070751\_\c_\dean\courses\algor
ithms-stanford\design.and.analysis.of.algorithms.1\programming-questions\common\
code\golang\src\algoutils\_test\_\c_\dean\courses\algorithms-stanford\design.and
.analysis.of.algorithms.1: The filename or extension is too long.


The Windows API has a problem with path names longer than 255 characters, unless the
path starts with "\\?\"

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

Activity

robpike

robpike commented on Sep 1, 2013

@robpike
Contributor

Comment 1:

Status changed to Duplicate.

Merged into issue #3358.

alexbrainman

alexbrainman commented on Sep 2, 2013

@alexbrainman
Member

Comment 2:

https://golang.org/issue/5027 would be an easier fix for this issue.
Or set GOPATH.
Alex
gopherbot

gopherbot commented on Sep 2, 2013

@gopherbot
ContributorAuthor

Comment 3 by dean.w.schulze:

Thanks for pointing this out, Alex.
I forgot to mention that this happens when GOPATH is not set and go test is using the
working directory.  (The part about using the working directory isn't in the docs or
help for go test and someone on go-nuts told me to try it.)
Should go test even be using the working directory?  I didn't know anything in the go
tool chain used the working directory.  Does the go tool chain normally include the
working directory or is this a one-off?
alexbrainman

alexbrainman commented on Sep 3, 2013

@alexbrainman
Member

Comment 4:

go command will always try current directory if you don't provide import path. Most of
the time that current directory will be located under %GOPATH%. If it is not, "go build"
and "go test" commands will still work. I am not sure how "official" these facilities
are, but we use them in a go build script
(https://code.google.com/p/go/source/browse/src/run.bat#66 and others).
Alex
locked and limited conversation to collaborators on Jun 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @robpike@gopherbot@alexbrainman

        Issue actions

          DOS shell can't handle deep directory structures with go test · Issue #6300 · golang/go