You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the new `RunEnvironmentInfo` provider in Bazel 5.3.0, `go_binary`
targets can now specify environment variables to be set when they are
executed with `bazel run`.
Since `RunEnvironmentInfo` generalizes the `testing.TestEnvironment`
provider, the existing usage is updated.
This builds an executable from a set of source files,
@@ -158,6 +158,7 @@ This builds an executable from a set of source files,
158
158
| <aid="go_binary-deps"></a>deps | List of Go libraries this package imports directly. These may be <code>go_library</code> rules or compatible rules with the [GoLibrary] provider. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |[]|
159
159
| <aid="go_binary-embed"></a>embed | List of Go libraries whose sources should be compiled together with this binary's sources. Labels listed here must name <code>go_library</code>, <code>go_proto_library</code>, or other compatible targets with the [GoLibrary] and [GoSource] providers. Embedded libraries must all have the same <code>importpath</code>, which must match the <code>importpath</code> for this <code>go_binary</code> if one is specified. At most one embedded library may have <code>cgo = True</code>, and the embedding binary may not also have <code>cgo = True</code>. See [Embedding] for more information. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |[]|
160
160
| <aid="go_binary-embedsrcs"></a>embedsrcs | The list of files that may be embedded into the compiled package using <code>//go:embed</code> directives. All files must be in the same logical directory or a subdirectory as source files. All source files containing <code>//go:embed</code> directives must be in the same logical directory. It's okay to mix static and generated source files and static and generated embeddable files. | <ahref="https://bazel.build/concepts/labels">List of labels</a> | optional |[]|
161
+
| <aid="go_binary-env"></a>env | Environment variables to set when the binary is executed with bazel run. The values (but not keys) are subject to [location expansion](https://docs.bazel.build/versions/main/skylark/macros.html) but not full [make variable expansion](https://docs.bazel.build/versions/main/be/make-variables.html). | <ahref="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
161
162
| <aid="go_binary-gc_goopts"></a>gc_goopts | List of flags to add to the Go compilation command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional |[]|
162
163
| <aid="go_binary-gc_linkopts"></a>gc_linkopts | List of flags to add to the Go link command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional |[]|
163
164
| <aid="go_binary-goarch"></a>goarch | Forces a binary to be cross-compiled for a specific architecture. It's usually better to control this on the command line with <code>--platforms</code>.<br><br> This disables cgo by default, since a cross-compiling C/C++ toolchain is rarely available. To force cgo, set <code>pure</code> = <code>off</code>.<br><br> See [Cross compilation] for more information. | String | optional | "auto" |
0 commit comments