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: transient "unexpected directory layout" error #21057

Closed
tsuna opened this issue Jul 17, 2017 · 8 comments
Closed

cmd/go: transient "unexpected directory layout" error #21057

tsuna opened this issue Jul 17, 2017 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@tsuna
Copy link
Contributor

tsuna commented Jul 17, 2017

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

go version go1.9beta2 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/tsuna/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9beta2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9beta2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8j/3m62t7m92958kqxt9s3chtrr0000gn/T/go-build954574771=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

While trying to update a package:

$ go get -u github.com/uber/go-torch
unexpected directory layout:
        import path: github.com/mattn/go-colorable
        root: /Users/tsuna/go/src
        dir: /Users/tsuna/go/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable
        expand root: /Users/tsuna/go/src
        expand dir: /Users/tsuna/go/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable
        separator: /
$ go get -u github.com/uber/go-torch
<success>

What did you expect to see?

go get should've either failed consistently or succeeded from the first time.

What did you see instead?

A transient and somewhat confusing "unexpected directory layout" error.

@odeke-em
Copy link
Member

@tsuna is this a regression from Go1.8?
/cc @rsc

@tsuna
Copy link
Contributor Author

tsuna commented Jul 21, 2017

I don't know, I've never seen this error before. The only similar issue I've found on GitHub was alecthomas/gometalinter#242 and that was reported with go1.8 already, but I don't know if it's the same problem.

@odeke-em
Copy link
Member

Aye aye, gotcha. Thanks for the update. I'll mark this as needing investigation and for Go1.10.

@odeke-em odeke-em added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 21, 2017
@odeke-em odeke-em added this to the Go1.10 milestone Jul 21, 2017
@pbdeuchler
Copy link

pbdeuchler commented Sep 25, 2017

I'm seeing this on go1.8.3

 → dockerc run --rm api go version
Starting xxx_postgres_1 ... done
go version go1.8.3 linux/amd64

It's definitely transient, and occurs even with pristine and brand new GOPATHs

@rsc
Copy link
Contributor

rsc commented Dec 1, 2017

I can't see how @tsuna's report can happen unless there are symlinks involved. (Symlinks are basically unsupported.) Somehow the package in his $GOPATH/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable has been loaded as if its fully-qualified import path were only "github.com/mattn/go-colorable" when in fact it should be "github.com/fatih/color/vendor/github.com/mattn/go-colorable". The most likely culprit for this kind of confusion is symlinks. I cannot reproduce the problem right now, although it should of course not be transient in any way.

I tried reproducing this with both Go 1.8 and Go 1.9, with no luck:

$ mkdir /tmp/gp1
$ GOPATH=/tmp/gp1 go1.9 get github.com/uber/go-torch
$ GOPATH=/tmp/gp1 go1.9 get -u github.com/uber/go-torch
$

If anyone can send a set of commands to reproduce this with a specific version of Go, starting with an empty GOPATH directory and not using Docker, that would be great.

@pbdeuchler since you didn't post any command output it's impossible to know whether you're really seeing the same problem @tsuna is or a different bug entirely.

@rsc rsc changed the title cmd/go/internal/load: transient "unexpected directory layout" error cmd/go: transient "unexpected directory layout" error Dec 1, 2017
@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 6, 2017
@ianlancetaylor ianlancetaylor modified the milestones: Go1.10, Go1.11 Dec 6, 2017
@F21
Copy link

F21 commented Dec 9, 2017

I believe I am seeing the same issue with symlinks using Go 1.10-beta1 (was fine in Go 1.9.2).

In my case, my project is copied into /source in the docker golang:1.10-rc-alpine image.

I then symlink the directory to /go/src/github.com/user/project, where /go is the GOPATH.

This is the output when I try to run go test -v $(go list ./... | grep -v /vendor/)t:

unexpected directory layout:
        import path: _/go/src/github.com/user/project/cockroachdb/cockroachdbpb
        root: /go/src
        dir: /go/src/github.com/user/project/cockroachdb/cockroachdbpb
        expand root: /go/src
        expand dir: /source/cockroachdb/cockroachdbpb
        separator: /

EDIT: I believe this is due to the way files are generated by go protobuf and not go itself.

@davecheney
Copy link
Contributor

davecheney commented Dec 9, 2017 via email

@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

8 participants