Go Tool: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 4: Line 4:
=Commands=
=Commands=
==<tt>build</tt>==
==<tt>build</tt>==
Compiles and builds an executable.
The <code>build</code> command compiles and builds an executable.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
cd ${PROJECT_DIR}
cd ${PROJECT_DIR}
Line 10: Line 10:
</syntaxhighlight>
</syntaxhighlight>
The command will create an executable named <code>main</code> and place it by default in the <code>${PROJECT_DIR}</code> directory.
The command will create an executable named <code>main</code> and place it by default in the <code>${PROJECT_DIR}</code> directory.
==<tt>doc</tt>==
The <code>doc</code> command prints documentation for a package.


==<tt>run</tt>==
==<tt>run</tt>==

Revision as of 01:24, 15 August 2023

Internal

Overview

Commands

build

The build command compiles and builds an executable.

cd ${PROJECT_DIR}
go build ./src/main/main.go

The command will create an executable named main and place it by default in the ${PROJECT_DIR} directory.

doc

The doc command prints documentation for a package.

run

cd $PROJECT_DIR
go run ./src/main/main.go