user1243746
user1243746

Reputation:

Which files are compiled?

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

Upvotes: 0

Views: 105

Answers (1)

axw
axw

Reputation: 7083

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.

Upvotes: 2

Related Questions