Skip to content

Commit

Permalink
[build] Refactor go_test and go_binary rules into pl_go_test and pl_g…
Browse files Browse the repository at this point in the history
…o_binary.

Summary:
This diff changes all go_test and go_binary rules to use our own macro wrappers called pl_go_test and pl_go_binary.
Currently, the wrappers don't do anything but this cleans up a future diff that will use them to explicitly disable PIE on all go binaries/tests.
Also, gazelle should respect the wrappers.

Test Plan: No functional changes. Ran all tests

Reviewers: zasgar, vihang

Reviewed By: vihang

Signed-off-by: James Bartlett <[email protected]>

Differential Revision: https://phab.corp.pixielabs.ai/D12758

GitOrigin-RevId: 0a6a85bd085e856221d202cf3855ead28efefcbc
  • Loading branch information
JamesMBartlett authored and copybaranaut committed Jan 11, 2023
1 parent 995173b commit 136d190
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
5 changes: 3 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_test")

go_library(
name = "pxapi",
Expand Down Expand Up @@ -55,7 +56,7 @@ filegroup(
visibility = ["//src:__subpackages__"],
)

go_test(
pl_go_test(
name = "pxapi_test",
srcs = ["results_test.go"],
embed = [":pxapi"],
Expand Down
5 changes: 3 additions & 2 deletions errdefs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_test")

go_library(
name = "errdefs",
Expand All @@ -32,7 +33,7 @@ go_library(
],
)

go_test(
pl_go_test(
name = "errdefs_test",
srcs = ["err_test.go"],
embed = [":errdefs"],
Expand Down
5 changes: 3 additions & 2 deletions examples/api_key_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "api_key_example_lib",
Expand All @@ -27,7 +28,7 @@ go_library(
],
)

go_binary(
pl_go_binary(
name = "api_key_example",
embed = [":api_key_example_lib"],
visibility = ["//visibility:public"],
Expand Down
5 changes: 3 additions & 2 deletions examples/basic_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "basic_example_lib",
Expand All @@ -28,7 +29,7 @@ go_library(
],
)

go_binary(
pl_go_binary(
name = "basic_example",
embed = [":basic_example_lib"],
visibility = ["//src:__subpackages__"],
Expand Down
5 changes: 3 additions & 2 deletions examples/deploykey_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "deploykey_example_lib",
Expand All @@ -24,7 +25,7 @@ go_library(
deps = ["//src/api/go/pxapi"],
)

go_binary(
pl_go_binary(
name = "deploykey_example",
embed = [":deploykey_example_lib"],
visibility = ["//src:__subpackages__"],
Expand Down
5 changes: 3 additions & 2 deletions examples/encryption_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "encryption_example_lib",
Expand All @@ -28,7 +29,7 @@ go_library(
],
)

go_binary(
pl_go_binary(
name = "encryption_example",
embed = [":encryption_example_lib"],
visibility = ["//src:__subpackages__"],
Expand Down
5 changes: 3 additions & 2 deletions examples/example_mux/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "example_mux_lib",
Expand All @@ -30,7 +31,7 @@ go_library(
],
)

go_binary(
pl_go_binary(
name = "example_mux",
embed = [":example_mux_lib"],
visibility = ["//src:__subpackages__"],
Expand Down
5 changes: 3 additions & 2 deletions examples/streaming_example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel:pl_build_system.bzl", "pl_go_binary")

go_library(
name = "streaming_example_lib",
Expand All @@ -28,7 +29,7 @@ go_library(
],
)

go_binary(
pl_go_binary(
name = "streaming_example",
embed = [":streaming_example_lib"],
visibility = ["//src:__subpackages__"],
Expand Down

0 comments on commit 136d190

Please sign in to comment.