blob: 99a2d784925147ca5c878a7ac02d6639aeff26d5 [file] [log] [blame]
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
load(":many_deps.bzl", "many_deps")
test_suite(name = "go_binary")
go_bazel_test(
name = "configurable_attribute_bad_test",
srcs = ["configurable_attribute_bad_test.go"],
)
go_bazel_test(
name = "configurable_attribute_good_test",
srcs = ["configurable_attribute_good_test.go"],
)
go_binary(
name = "hello",
srcs = ["hello.go"],
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
srcs = ["out_test.go"],
data = [":custom_bin"],
)
go_bazel_test(
name = "package_conflict_test",
srcs = ["package_conflict_test.go"],
)
go_binary(
name = "custom_bin",
srcs = ["custom_bin.go"],
out = "alt_bin",
)
go_binary(
name = "goos_pure_bin",
srcs = [
"broken_cgo.go",
"hello.go",
],
goarch = "amd64",
goos = "plan9",
)
many_deps(name = "many_deps")
go_test(
name = "stamp_test",
srcs = ["stamp_test.go"],
data = [":stamp_bin"],
rundir = ".",
deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
)
go_binary(
name = "stamp_bin",
srcs = ["stamp_bin.go"],
embed = [":stamp_embed"],
x_defs = {
"Bin": "Bin",
"example.com/stamp_dep.DepBin": "DepBin",
},
deps = [":stamp_dep"],
)
go_library(
name = "stamp_embed",
srcs = ["stamp_embed.go"],
importpath = "example.com/stamp_embed",
x_defs = {
"Embed": "Embed",
},
)
go_library(
name = "stamp_dep",
srcs = ["stamp_dep.go"],
importpath = "example.com/stamp_dep",
x_defs = {
"DepSelf": "DepSelf",
},
)
go_binary(
name = "hello_pie_bin",
srcs = ["hello.go"],
cgo = True,
linkmode = "pie",
tags = ["manual"],
)
go_binary(
name = "hello_nopie_bin",
srcs = ["hello.go"],
cgo = True,
tags = ["manual"],
)
go_test(
name = "pie_test",
srcs = [
"pie_darwin_amd64_test.go",
"pie_darwin_test.go",
"pie_linux_test.go",
],
data = select({
"@io_bazel_rules_go//go/platform:darwin": [
":hello_nopie_bin",
":hello_pie_bin",
],
"@io_bazel_rules_go//go/platform:linux": [
":hello_nopie_bin",
":hello_pie_bin",
],
"//conditions:default": [],
}),
rundir = ".",
deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
)
go_test(
name = "static_test",
srcs = ["static_test.go"],
data = select({
"@io_bazel_rules_go//go/platform:linux": [
":static_bin",
":static_cgo_bin",
":static_pure_bin",
],
"//conditions:default": [],
}),
rundir = ".",
deps = ["//go/tools/bazel:go_default_library"],
)
go_binary(
name = "static_bin",
srcs = ["static_bin.go"],
static = "on",
tags = ["manual"],
deps = ["@org_golang_x_sys//unix:go_default_library"],
)
go_binary(
name = "static_cgo_bin",
srcs = ["static_cgo_bin.go"],
cgo = True,
static = "on",
tags = ["manual"],
)
go_binary(
name = "static_pure_bin",
srcs = ["static_pure_bin.go"],
pure = "on",
static = "on",
tags = ["manual"],
)
go_binary(
name = "tags_bin",
srcs = [
"tags_main_bad.go",
"tags_main_good.go",
],
gotags = ["good"],
deps = [":tags_lib"],
)
go_library(
name = "tags_lib",
srcs = [
"tags_lib_bad.go",
"tags_lib_good.go",
],
importpath = "tags_lib",
tags = ["manual"],
)
go_binary(
name = "prefix",
embed = ["//tests/core/go_binary/prefix"],
)
go_bazel_test(
name = "non_executable_test",
srcs = ["non_executable_test.go"],
)