Golang gc: Difference between revisions

From wikinotes
Line 3: Line 3:
= run =
= run =
<blockquote>
<blockquote>
<code>go run</code> will build and run an executable.
<code>go run</code> is a convenience tool that builds/runs an executable.<br>
it accepts all of the same build-flags as <code>go build</code>.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">

Revision as of 01:04, 19 June 2022

This page documents the builtin golang compilation tools.

run

go run is a convenience tool that builds/runs an executable.
it accepts all of the same build-flags as go build.

go run .                  # compile package at cwd, and run it's 'main()' method
go run . --help           # cli params for the program can be passed to go run

go run main.go lib.go ... # compile only these files, and run detected 'main()' method
go run some/package       # compile a specific package

build

clean

install