2016-10-23 3 views
0

Windows에 설치됨. GOPATH이 설정됩니다go 설치를 실행하면 오류가 발생 함

C:\go-workspace\src\github.com\llnw\login 

login.go이 포함되어 있습니다 :

c:\go-workspace 

나는이 디렉토리에있는 파일이라는 login.go이

package main 
    func main() { 
     fmt.Printf("login\n") 
    } 

는 내가 빌드 다음 시도 :

go build github.com/llnw/login/login 

그러나 이 오류는 다음과 같습니다.

can't load package: package github.com/llnw/login/login: cannot find package "github.com/llnw/login/login" in any of: 
    C:\Go\src\github.com\llnw\login\login (from $GOROOT) 
    C:\go-workspace\src\github.com\llnw\login\login (from $GOPATH) 

무엇이 잘못 되었나요? go build -h에서

+1

패키지가'github.com/llnw/login'이고'github.com/llnw/login/login'이 아니라면'go build github.com/llnw/login'을 실행하십시오 –

+0

감사합니다, Yandry. 당신은 질문에 대답했지만 체크 표시가 없으므로 당신이 대답했다고 말할 수는 없습니다. –

답변

0

: 당신의 예에서

usage: build [-o output] [-i] [build flags] [packages] 

Build compiles the packages named by the import paths, 
along with their dependencies, but it does not install the results. 

If the arguments to build are a list of .go files, build treats 
them as a list of source files specifying a single package. 

, github.com/llnw/login/login 외모도 패키지,도 .go 파일의 목록이있다. 아마 당신이 찾고 :

go build github.com/llnw/login 

가이 명령을 실행할 때, 상대 경로 github.com/llnw/login가 존재한다고 가정.

관련 문제