编译哪些文件?

How to know which files are going to be compiled and linked when you have several files which are specific to a system?

There are at least a couple of options:

  1. Use go build -n to list the commands that would be executed by a build, and then parse the output.
  2. Use the go/build package. Specifically, look at the Import function.

I suggest the second method; if I understand your question correctly it does what you need. You specify a package to "import", and it returns a Package structure which contains, among other things, the set of Go, C, ASM files that will be compiled.