• Home
Name Date Size #Lines LOC

..--

prefix/04-Jul-2025-139

BUILD.bazelD04-Jul-20253.7 KiB194169

README.rstD04-Jul-20252.1 KiB7152

broken_cgo.goD04-Jul-2025173 82

configurable_attribute_bad_test.goD04-Jul-20251.7 KiB7047

configurable_attribute_good_test.goD04-Jul-20252 KiB9361

custom_bin.goD04-Jul-202530 53

hello.goD04-Jul-202574 85

many_deps.bzlD04-Jul-20252.5 KiB9385

non_executable_test.goD04-Jul-20252.2 KiB8862

out_test.goD04-Jul-2025152 1411

package_conflict_test.goD04-Jul-20252.4 KiB12182

pie_darwin_amd64_test.goD04-Jul-2025861 3214

pie_darwin_test.goD04-Jul-2025591 3628

pie_linux_test.goD04-Jul-2025897 4937

stamp_bin.goD04-Jul-2025251 1712

stamp_dep.goD04-Jul-202571 75

stamp_embed.goD04-Jul-202537 42

stamp_test.goD04-Jul-2025501 3025

static_bin.goD04-Jul-2025126 85

static_cgo_bin.goD04-Jul-2025124 155

static_pure_bin.goD04-Jul-202558 96

static_test.goD04-Jul-20251.3 KiB4626

tags_lib_bad.goD04-Jul-202553 62

tags_lib_good.goD04-Jul-202512 21

tags_main_bad.goD04-Jul-202554 62

tags_main_good.goD04-Jul-202567 94

README.rst

1Basic go_binary functionality
2=============================
3
4.. _go_binary: /docs/go/core/rules.md#_go_binary
5.. _#2168: https://github.com/bazelbuild/rules_go/issues/2168
6.. _#2463: https://github.com/bazelbuild/rules_go/issues/2463
7
8Tests to ensure the basic features of go_binary are working as expected.
9
10hello
11-----
12
13Hello is a basic "hello world" program that doesn't do anything interesting.
14Useful as a primitive smoke test -- if this doesn't build, nothing will.
15
16out_test
17--------
18
19Tests that a `go_binary`_ rule can write its executable file with a custom name
20in the package directory (not the mode directory).
21
22package_conflict_test
23---------------------
24
25Tests that linking multiple packages with the same path (`importmap`) is an
26error.
27
28goos_pure_bin
29-------------
30
31Tests that specifying the `goos` attribute on a `go_binary`_ target to be
32different than the host os forces the pure mode to be on. This is achieved
33by including a broken cgo file in the sources for the build.
34
35many_deps
36---------
37
38Test that a `go_binary`_ with many imports with long names can be linked. This
39makes sure we don't exceed command-line length limits with -I and -L flags.
40Verifies #1637.
41
42stamp_test
43----------
44Test that the `go_binary`_ ``x_defs`` attribute works correctly, both in a
45binary and in an embedded library. Tests regular stamps and stamps that
46depend on values from the workspace status script. Verifies #2000.
47
48pie_test
49--------
50Tests that specifying the ``linkmode`` attribute on a `go_binary`_ target to be
51pie produces a position-independent executable and that no specifying it produces
52a position-dependent binary.
53
54static_test
55-----------
56Test that `go_binary`_ rules with ``static = "on"`` with and without cgo
57produce static binaries. Verifies `#2168`_.
58
59This test only runs on Linux. The darwin external linker cannot produce
60static binaries since there is no static version of C runtime libraries.
61
62tags_bin
63--------
64Checks that setting ``gotags`` affects source filtering. This binary won't build
65without a specific tag being set.
66
67prefix
68------
69This binary has a name that conflicts with a subdirectory. Its output file
70name should not have this conflict. Verifies `#2463`_.
71