-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreformat.sh
executable file
·35 lines (27 loc) · 984 Bytes
/
reformat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
set -eu
cd "$(dirname "$0")"
# Go dependencies
find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true
bazel build -k $(bazel query --output=label 'kind("go_proto_library", //...)') || true
find bazel-bin/pkg/proto -name '*.pb.go' | while read f; do
cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')
done
#go get -d -u ./... || true
go mod tidy || true
# Gazelle
find . -name '*.pb.go' -delete
rm -f $(find . -name '*.proto' | sed -e 's/[^/]*$/BUILD.bazel/')
bazel run //:gazelle
# bzlmod
bazel mod tidy
# Go
bazel run @cc_mvdan_gofumpt//:gofumpt -- -w -extra $(pwd)
# Protobuf
find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +
# Generated .pb.go files
find bazel-bin/pkg/proto -name '*.pb.go' -delete || true
bazel build $(bazel query --output=label 'kind("go_proto_library", //...)')
find bazel-bin/pkg/proto -name '*.pb.go' | while read f; do
cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')
done