Version: v0.3.3 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2015 License: MIT Imports: 27 Imported by: 0



gb, a project based build tool for the Go programming language.


gb command [arguments]

The commands are:

build       build a package
doc         show documentation for a package or symbol
env         print project environment variables
generate    generate Go files by processing source
info        info returns information about this project
list        list the packages named by the importpaths
test        test packages

Use "gb help [command]" for more information about a command.

Additional help topics:

plugin      plugin information
project     gb project layout

Use "gb help [topic]" for more information about that topic.

Build a package


gb build [build flags] [packages]

Build compiles the packages named by the import paths, along with their dependencies.


	ignore cached packages if present, new packages built will overwrite
	any cached packages. This effectively disables incremental
	do not cache packages, cached packages will still be used for
	incremental compilation. -f -F is advised to disable the package
	caching system.
	decreases verbosity, effectively raising the output level to ERROR.
	In a successful build, no output will be displayed.
	The number of build jobs to run in parallel, including test execution.
	By default this is the number of CPUs visible to gb.
	sets the base of the project root search path from the current working
	directory to the value supplied. Effectively gb changes working
	directory to this path before searching for the project root.
	if provided, gb will output a dot formatted file of the build steps to
	be performed.
-ldflags 'flag list'
	arguments to pass on each linker invocation.
-gcflags 'arg list'
	arguments to pass on each compile invocation.
-tags 'tag list'
	additional build tags.

The list flags accept a space-separated list of strings. To embed spaces in an element in the list, surround it with either single or double quotes.

For more about where packages and binaries are installed, run 'gb help project'.

Show documentation for a package or symbol


gb doc <pkg> <sym>[.<method>]

Doc shows documentation for a package or symbol.

See 'go help doc'.

Print project environment variables


gb env

Env prints project environment variables.

Generate Go files by processing source


gb generate [-run regexp] [file.go... | packages]

Generate runs commands described by directives within existing files.

Those commands can run any process, but the intent is to create or update Go source files, for instance by running yacc.

See 'go help generate'.

Info returns information about this project


gb info

info prints gb environment information.


	The root of the gb project.
	The list of gb project source directories.
	The path of the gb project's package cache.
	The suffix applied any binary written to $GB_PROJECT_DIR/bin
	The value of runtime.GOROOT for the Go version that built this copy of gb.

info returns 0 if the project is well formed, and non zero otherwise.

List the packages named by the importpaths


gb list [-s] [-f format] [-json] [packages]

List lists packages imported by the project.

The default output shows the package import paths:

% gb list


	alternate format for the list, using the syntax of package template.
	The default output is equivalent to -f '{{.ImportPath}}'. The struct
	being passed to the template is currently an instance of gb.Package.
	This structure is under active development and it's contents are not
	guaranteed to be stable.
	read format template from STDIN.
	prints output in structured JSON format. WARNING: gb.Package
	structure is not stable and will change in the future!

Plugin information

gb supports git style plugins.

A gb plugin is anything in the $PATH with the prefix gb-. In other words gb-something, becomes gb something.

gb plugins are executed from the parent gb process with the environment variable, GB_PROJECT_DIR set to the root of the current project.

gb plugins can be executed directly but this is rarely useful, so authors should attempt to diagnose this by looking for the presence of the GB_PROJECT_DIR environment key.

Gb project layout

A gb project is defined as any directory that contains a src/ subdirectory. gb automatically detects the root of the project by looking at the current working directory and walking backwards until it finds a directory that contains a src/ subdirectory.

In the event you wish to override this auto detection mechanism, the -R flag can be used to supply a project root.

See for details

Test packages


gb test [build flags] -v [packages] [flags for test binary]

Test automates testing the packages named by the import paths.

'gb test' recompiles each package along with any files with names matching the file pattern "*_test.go".


        print output from test subprocess.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL