1load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") 2load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test") 3load(":many_deps.bzl", "many_deps") 4 5test_suite(name = "go_binary") 6 7go_bazel_test( 8 name = "configurable_attribute_bad_test", 9 srcs = ["configurable_attribute_bad_test.go"], 10) 11 12go_bazel_test( 13 name = "configurable_attribute_good_test", 14 srcs = ["configurable_attribute_good_test.go"], 15) 16 17go_binary( 18 name = "hello", 19 srcs = ["hello.go"], 20 visibility = ["//visibility:public"], 21) 22 23go_test( 24 name = "go_default_test", 25 srcs = ["out_test.go"], 26 data = [":custom_bin"], 27) 28 29go_bazel_test( 30 name = "package_conflict_test", 31 srcs = ["package_conflict_test.go"], 32) 33 34go_binary( 35 name = "custom_bin", 36 srcs = ["custom_bin.go"], 37 out = "alt_bin", 38) 39 40go_binary( 41 name = "goos_pure_bin", 42 srcs = [ 43 "broken_cgo.go", 44 "hello.go", 45 ], 46 goarch = "amd64", 47 goos = "plan9", 48) 49 50many_deps(name = "many_deps") 51 52go_test( 53 name = "stamp_test", 54 srcs = ["stamp_test.go"], 55 data = [":stamp_bin"], 56 rundir = ".", 57 deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"], 58) 59 60go_binary( 61 name = "stamp_bin", 62 srcs = ["stamp_bin.go"], 63 embed = [":stamp_embed"], 64 x_defs = { 65 "Bin": "Bin", 66 "example.com/stamp_dep.DepBin": "DepBin", 67 }, 68 deps = [":stamp_dep"], 69) 70 71go_library( 72 name = "stamp_embed", 73 srcs = ["stamp_embed.go"], 74 importpath = "example.com/stamp_embed", 75 x_defs = { 76 "Embed": "Embed", 77 }, 78) 79 80go_library( 81 name = "stamp_dep", 82 srcs = ["stamp_dep.go"], 83 importpath = "example.com/stamp_dep", 84 x_defs = { 85 "DepSelf": "DepSelf", 86 }, 87) 88 89go_binary( 90 name = "hello_pie_bin", 91 srcs = ["hello.go"], 92 cgo = True, 93 linkmode = "pie", 94 tags = ["manual"], 95) 96 97go_binary( 98 name = "hello_nopie_bin", 99 srcs = ["hello.go"], 100 cgo = True, 101 tags = ["manual"], 102) 103 104go_test( 105 name = "pie_test", 106 srcs = [ 107 "pie_darwin_amd64_test.go", 108 "pie_darwin_test.go", 109 "pie_linux_test.go", 110 ], 111 data = select({ 112 "@io_bazel_rules_go//go/platform:darwin": [ 113 ":hello_nopie_bin", 114 ":hello_pie_bin", 115 ], 116 "@io_bazel_rules_go//go/platform:linux": [ 117 ":hello_nopie_bin", 118 ":hello_pie_bin", 119 ], 120 "//conditions:default": [], 121 }), 122 rundir = ".", 123 deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"], 124) 125 126go_test( 127 name = "static_test", 128 srcs = ["static_test.go"], 129 data = select({ 130 "@io_bazel_rules_go//go/platform:linux": [ 131 ":static_bin", 132 ":static_cgo_bin", 133 ":static_pure_bin", 134 ], 135 "//conditions:default": [], 136 }), 137 rundir = ".", 138 deps = ["//go/tools/bazel:go_default_library"], 139) 140 141go_binary( 142 name = "static_bin", 143 srcs = ["static_bin.go"], 144 static = "on", 145 tags = ["manual"], 146 deps = ["@org_golang_x_sys//unix:go_default_library"], 147) 148 149go_binary( 150 name = "static_cgo_bin", 151 srcs = ["static_cgo_bin.go"], 152 cgo = True, 153 static = "on", 154 tags = ["manual"], 155) 156 157go_binary( 158 name = "static_pure_bin", 159 srcs = ["static_pure_bin.go"], 160 pure = "on", 161 static = "on", 162 tags = ["manual"], 163) 164 165go_binary( 166 name = "tags_bin", 167 srcs = [ 168 "tags_main_bad.go", 169 "tags_main_good.go", 170 ], 171 gotags = ["good"], 172 deps = [":tags_lib"], 173) 174 175go_library( 176 name = "tags_lib", 177 srcs = [ 178 "tags_lib_bad.go", 179 "tags_lib_good.go", 180 ], 181 importpath = "tags_lib", 182 tags = ["manual"], 183) 184 185go_binary( 186 name = "prefix", 187 embed = ["//tests/core/go_binary/prefix"], 188) 189 190go_bazel_test( 191 name = "non_executable_test", 192 srcs = ["non_executable_test.go"], 193) 194