Skip to content

Commit

Permalink
Replace //linters:gofmt with normal go fmt call
Browse files Browse the repository at this point in the history
.cc and .h files needed to be moved to not be in the same folder as go files to be compatible with this way of running go fmt

Test: Tested that a local unformated file was formatted
Bug: N/A
Change-Id: Ie5866fc36d804348d128fac38836903e7414d578
GitOrigin-RevId: 1994e2be452b4cc84632aad4fa48a8eac25bd623
  • Loading branch information
bentekkie authored and copybara-github committed Jun 21, 2024
1 parent ba1cdf1 commit 31cac29
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 23 deletions.
7 changes: 1 addition & 6 deletions examples/proxyclient/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

# gazelle:exclude test.h

go_library(
name = "proxyclient_lib",
srcs = ["main.go"],
Expand All @@ -16,10 +14,7 @@ go_library(

go_binary(
name = "proxyclient",
data = [
"test.cpp",
"test.h",
],
data = glob(["testdata/**"]),
embed = [":proxyclient_lib"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion examples/proxyclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {
res, err := client.RunCommand(ctx, &ppb.RunRequest{
Labels: map[string]string{"type": "compile", "lang": "cpp", "compiler": "clang"},
Command: &cpb.Command{
Args: []string{"clang", "-c", "-o", "test.o", "examples/proxyclient/test.cpp"},
Args: []string{"clang", "-c", "-o", "test.o", "examples/proxyclient/testdata/test.cpp"},
ExecRoot: wd,
Platform: map[string]string{
"container-image": "docker://gcr.io/foundry-x-experiments/proxy-test@sha256:af0af0a78b2766398b1789c01d1665547b97246b7adc4848df5ebbfa21fab490",
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions linters/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
sh_binary(
name = "gofmt",
srcs = ["run_in_workspace.sh"],
args = [
"$(location @go_sdk//:bin/gofmt)",
],
data = [
"@go_sdk//:bin/gofmt",
],
tags = [
"local",
"manual",
],
)

sh_binary(
name = "clang-format",
srcs = ["run_in_workspace.sh"],
Expand Down
2 changes: 1 addition & 1 deletion scripts/precommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

LINTPASS=true
echo Running gofmt...
bazelisk run --ui_event_filters=-info,-stderr --noshow_progress //linters:gofmt -- -w .
bazelisk run --ui_event_filters=-info,-stderr --noshow_progress @io_bazel_rules_go//go -- fmt ./...
STAGED_CPP_FILES="$(git diff --cached --name-only --diff-filter=d | grep "\.cc$\|\.h$")"
if [ -n "$STAGED_CPP_FILES" ]; then
echo Running clang-format...
Expand Down

0 comments on commit 31cac29

Please sign in to comment.