问题
So I downloaded minio from github.com/minio/minio
I want to run it from the source,
I create my directory like:
~/Downloads/minio-RELEASE.2017-06-13T19-01-01Z
|
src
|
all minio directories, including vendor, like the image below
I also use godep
resolve other dependencies under GOPATH.
Now I run it from Gogland(go IDE)
It shows:
GOROOT=/usr/local/Cellar/go/1.8.3/libexec
GOPATH=/Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z:/Users/xl/go
/usr/local/Cellar/go/1.8.3/libexec/bin/go build -i -o /private/var/folders/8v/6dg7d6mx2850sv1gp8ts9thm0000gn/T/go_run_main_gogo /Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z/src/main.go
unexpected directory layout:
import path: github.com/Azure/azure-sdk-for-go/storage
root: /Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z/src
dir: /Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z/src/vendor/github.com/Azure/azure-sdk-for-go/storage
expand root: /Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z/src
expand dir: /Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z/src/vendor/github.com/Azure/azure-sdk-for-go/storage
separator: /
Now I am confused that, what's the problem? The files are all there and the directories are just like what's it's printing. How do I fix it? Thanks.
回答1:
See GitHub code layout
$GOPATH
is the root of the project - each of your Github repos will be checked out several folders below$GOPATH
.
Your$GOPATH
variable will point to the root of your Go workspace, as described in How to Write Go Code.
In your case, below your GOPATH
folder, you should have
src/github.com/minio/minio
Anf only then "all minio directories, including vendor"
回答2:
On Golang 1.13 it suddenly happened to me on all my code after upgrading from 1.11 to 1.13.
It seems golang 1.13 does not like anymore imports like "./something".
I had to develop any import like "myapp/something"
回答3:
This can happen if you have duplicate repos under goroot AND gopath. Delete the goroot one.
来源:https://stackoverflow.com/questions/45428744/golang-unexpected-directory-layout