检查软件包是否会生成

How can I determine if a package will build, without installing it, running its tests, or generating a binary?

There's a mention that using go build with more than one package just tests if they build. How can I do that for a single package?

go build

For package main, a binary will be generated by go build. You can dump that in a tmp directory that the OS will clean for you later.

go build -o /tmp/oswilldeleteme

Unfortunately, you can not pipe the output of go build to the null device. See this issue: https://github.com/golang/go/issues/4851