GoLink: force external link for static binaries (#2175)

By default on Linux, the Go linker may produce a static binary if no
packages require cgo. net and os both require cgo, so for non-trivial
programs, the external linker will NOT be used, and the internal
linker will produce a dynamically linked executable.

With this change, in static mode, we force external linking. We were
already passing -static to the external linker, but we weren't always
using the external linker.

Fixes #2168
6 files changed