Go tool link: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * <tt>go tool</tt>")
 
Line 1: Line 1:
=External=
* https://pkg.go.dev/cmd/link
=Internal=
=Internal=
* [[Go_Tool#link|<tt>go tool</tt>]]
* [[Go_Tool#link|<tt>go tool</tt>]]
=Overview=
The linker is typically invoked as <code>go tool link</code> or as part of the <code>go build</code> command. It reads the Go archive or object for a package <code>main</code>, along with its dependencies, and combines them into an executable binary.
=Options=
When invoked by <code>go build</code>, all of the following options can be passed from <code>go build</code> command line with the <code>-ldflags</code> option. For syntax, see: {{Internal|Go_build#-ldflags|<tt>go build -ldflags</tt>}}

Revision as of 22:34, 1 March 2024

External

Internal

Overview

The linker is typically invoked as go tool link or as part of the go build command. It reads the Go archive or object for a package main, along with its dependencies, and combines them into an executable binary.

Options

When invoked by go build, all of the following options can be passed from go build command line with the -ldflags option. For syntax, see:

go build -ldflags