Skip to content

Go tool compatibility

Jay Conrod edited this page Apr 16, 2020 · 1 revision

Go tool compatibility

This is a list of all the capabilities of the go tool, and what they map to in the bazel world. This is both a mapping for documentation and a list of things that still need to be done.

Go commands, and what they do and what they map to

build

compile packages and dependencies bazel build

clean

remove object files bazel clean but not really needed

doc

show documentation for package or symbol TODO

env

print Go environment information Not needed?

bug

start a bug report Not sure if we want this

fix

run go tool fix on packages TODO

fmt

run gofmt on package sources TODO

generate

generate Go files by processing source Custom rules

get

download and install packages and dependencies Download is automatic, install is not needed, but automatic dependencies belong in gazelle

install

compile and install packages and dependencies Not really needed

list

list packages bazel query

run

compile and run Go program bazel run

test

test packages bazel test

tool

run specified go tool See section below

version

print Go version In theory you specified this in the config, not sure a query is needed.

vet

run go tool vet on packages go_vet_test rule

Go tools and what they map to

addr2line

Not sure we need this exposed

api

Not sure we need this exposed

asm

Used in go_library

cgo

Used in go_library

compile

Used in go_library

cover

bazel cover but there are still open questions about controlling it and exposing the results.

dist

Not sure we need this exposed

doc

See doc command

fix

See fix command

link

Used in go_binary/go_test

nm

Not sure we need this exposed

objdump

Not sure we need this exposed

pack

Used in go_library

pprof

Not sure we need this exposed

trace

TODO

vet

See vet command