gpt4 book ai didi

github - 为什么不能构建 godef.go?

转载 作者:数据小太阳 更新时间:2023-10-29 03:41:14 25 4
gpt4 key购买 nike

first I pull the soure code or zipfile, They both show the same error log like this when I go build godef.go.

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

最佳答案

从多文件 Go 包或命令构建单个 Go 文件是没有意义的。构建所有文件。例如,

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

$ go build *.go

或者,简单地构建包或命令

$ go build github.com/rogpeppe/godef

为什么要使用 go build 而不是 go install

您为什么要“拉取源代码或 zip 文件”?使用 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

关于github - 为什么不能构建 godef.go?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44224955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com