首先我拉出了源代码或zip文件,当我去构建godef.go时,它们都显示相同的错误日志。
go build godef.go
# command-line-arguments
.\godef.go:55: undefined: acmeFile
.\godef.go:59: undefined: acmeCurrentFile
答案 0 :(得分:1)
从多文件Go包或命令构建单个Go文件没有任何意义。构建所有文件。例如,
$ go build godef.go acme.go doc.go
或
$ go build *.go
或者,只需构建包或命令
$ go build github.com/rogpeppe/godef
为什么使用go build
代替go install
?
你为什么“拉出原始代码或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
参考: