Go Tool: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:
==<tt>doc</tt>==
==<tt>doc</tt>==
The <code>doc</code> command prints documentation for a package.
The <code>doc</code> command prints documentation for a package.
==<tt>fmt</tt>==
The <code>fmt</code> ("format") command formats source code files.


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

Revision as of 01:27, 15 August 2023

Internal

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 after the first source file, in this case main, and will place it by default in the ${PROJECT_DIR} directory.

doc

The doc command prints documentation for a package.

fmt

The fmt ("format") command formats source code files.

run

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