我使用go build
生成文件。但我只能生成main
,这意味着go build main.go
有效,而go build dao.go
无法生成任何内容?
如何生成dao
?
答案 0 :(得分:7)
来自go help build
:
When the command line specifies a single main package,
build writes the resulting executable to output.
Otherwise build compiles the packages but discards the results,
serving only as a check that the packages can be built.