This works: bazel build :main
This doesn't: bazel build :main --experimental_action_listener=//:my_action_listener
Loading: 0 packages loaded
Analyzing: target //:main (0 packages loaded, 0 targets configured)
INFO: Analysed target //:main (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 18] no action
ERROR: /usr/local/google/home/justinbuchanan/src/justin/gobug/BUILD:3:1: CGoCodeGen //:main%nacl_amd64p32%cgo_codegen failed (Exit 1) cgo failed: error executing command bazel-out/host/bin/external/io_bazel_rules_go/go/tools/builders/linux_amd64_stripped/cgo -sdk external/go_sdk -installsuffix nacl_amd64p32 -src ... (remaining 19 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
unknown ptrSize for $GOARCH "amd64p32"
CgoCodegen: error running subcommand: exit status 2
Target //:main failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.231s, Critical Path: 0.11s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
INFO: 1 process: 1 linux-sandbox.
FAILED: Build did NOT complete successfully
For some reason, adding an action listener to the mix triggers cgo builds for all supported architectures. The specific error message differs based on which one of these non-host-architecture targets bazel tries to build first.