Search code examples
go

What is the difference between "compile" and "build" in Go?


What is the accurate difference between "compile" and "build" in Go?


Solution

  • The go command internally calls an internal tool called compile which produces so-called "object files" from the source code files. It then calls the internal tool called link which takes those object code files and produces a final executable image file or a package—depending on what is being built.

    I think you should start with this, then this and then run the go build command passing it the -x command-line parameter, making it verbosely print what is does.