can't load package: package .: no buildable Go source files

后端 未结 7 734
無奈伤痛
無奈伤痛 2020-12-13 03:29

Here is the error message:

% go get     
can\'t load package: package .: no buildable Go source files in /Users/7yan00

% echo $GOPATH     
/Users/7yan00/Gol         


        
相关标签:
7条回答
  • 2020-12-13 04:06

    Make sure you are using that command in the Go project source folder (like /Users/7yan00/Golang/src/myProject).

    One alternative (similar to this bug) is to use the -d option (see go get command)

    go get -d
    

    The -d flag instructs get to stop after downloading the packages; that is, it instructs get not to install the packages.

    See if that helps in your case.


    But more generally, as described in this thread:

    go get is for package(s), not for repositories.

    so if you want a specific package, say, go.text/encoding, then use

    go get code.google.com/p/go.text/encoding
    

    if you want all packages in that repository, use ... to signify that:

    go get code.google.com/p/go.text/...
    
    0 讨论(0)
提交回复
热议问题