2017-05-28 73 views
-2

首先,我拉取soure代碼或zipfile,當我去構建godef.go時,它們都會顯示相同的錯誤日誌。爲什麼不能建立godef.go?

go build godef.go 
# command-line-arguments 
.\godef.go:55: undefined: acmeFile 
.\godef.go:59: undefined: acmeCurrentFile 

回答

1

建設從多文件轉到包或命令單個去文件是沒有意義的。構建所有文件。例如,

$ go build godef.go acme.go doc.go 

$ go build *.go 

或者,你爲什麼要使用go build,而不是簡單地go install構建軟件包或命令

$ go build github.com/rogpeppe/godef 

你爲什麼「拉索雷[原文]代碼或zipfile」?使用go get,它不爲你go install,例如,

$ go get -v -u github.com/rogpeppe/godef 
github.com/rogpeppe/godef (download) 
github.com/rogpeppe/godef/vendor/9fans.net/go/plan9 
github.com/rogpeppe/godef/go/token 
github.com/rogpeppe/godef/go/scanner 
github.com/rogpeppe/godef/go/ast 
github.com/rogpeppe/godef/vendor/9fans.net/go/plan9/client 
github.com/rogpeppe/godef/vendor/9fans.net/go/acme 
github.com/rogpeppe/godef/go/parser 
github.com/rogpeppe/godef/go/printer 
github.com/rogpeppe/godef/go/types 
github.com/rogpeppe/godef 

參考:

Command go