-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix.sh
executable file
·117 lines (111 loc) · 4.64 KB
/
fix.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
ZEROLINT="$(which zerolint)"
if [ -z "$ZEROLINT" ]; then
go install fillmore-labs.com/zerolint@latest
ZEROLINT="$(go env GOPATH)/bin/zerolint"
fi
[ -x "$ZEROLINT" ] || exit 1
WIRE="$(which wire)"
if [ -z "$WIRE" ]; then
go install github.com/google/wire/cmd/wire@latest
WIRE="$(go env GOPATH)/bin/wire"
fi
[ -x "$WIRE" ] || exit 1
go env -w CC=cc CXX=c++ CGO_ENABLED=1 GOEXPERIMENT=synctest
EXCLUDES="$(pwd)/excludes"
PROFILES="$(pwd)/profiles"
LOGS="$(pwd)/logs"
mkdir -p "$PROFILES" "$LOGS"
for i in temp/*/*; do
if [ ! -d $i ]; then
echo "run ./prepare.sh first"
exit 1
fi
(cd $i && git restore :/)
I="$(echo $i | sed -e 's#^temp/\([^/]*\)/\([^/]*\)$#\1_\2#')"
if [ ! -r "$EXCLUDES/$I.txt" ]; then
echo "# zerolint exclusions for $i" > "$EXCLUDES/$I.txt"
fi
case $i in
temp/grafana/grafana)
if [ ! -e "$i/pkg/server/wire_gen.go" ]; then
(cd "$i" && "$WIRE" gen -tags oss ./pkg/server)
fi
;;
temp/bazelbuild/bazelisk)
(cd "$i" && go mod tidy)
;;
esac
for j in lint fulllint first second; do
LOG="$LOGS/${I}_$j.log"
if [ ! -e "$LOG" ]; then
case $j in
lint)
FLAGS="-generated -c 0"
;;
fulllint)
FLAGS="-generated -full -c 0"
;;
*)
# PROFILE="-cpuprofile \"$PROFILES/${I}_$j.prof\" "
FLAGS="-full -zerotrace -excluded $EXCLUDES/$I.txt -fix"
;;
esac
echo "Running zerolint on $i, $j pass..."
find $i -type d \(\
-name _asm -o \
-path temp/99designs/gqlgen/_examples -o \
-path temp/Azure/azure-sdk-for-go/sdk/azidentity/testdata/managed-id-test -o \
-path temp/Azure/azure-sdk-for-go/sdk/data/aztables/testdata/perf -o \
-path temp/Azure/azure-sdk-for-go/sdk/storage/azblob/testdata/perf -o \
-path temp/Azure/azure-service-operator/docs/hugo -o \
-path temp/cue-lang/cue/internal/golangorgx/vendoring -o \
-path temp/etcd-io/etcd/tools/mod -o \
-path temp/go-language-server/protocol/tools -o \
-path temp/go101/golds/internal/testing/examples -o \
-path temp/goccy/go-yaml/benchmarks -o \
-path temp/goccy/go-yaml/docs/playground -o \
-path temp/gohugoio/hugo/docs -o \
-path temp/golang/vscode-go/docs -o \
-path temp/golang/vscode-go/extension/test/testdata -o \
-path temp/golangci/golangci-lint/pkg/golinters/\*/testdata -o \
-path temp/golingon/lingon/docs -o \
-path temp/google/go-github/example/newreposecretwithlibsodium -o \
-path temp/google/osv-scanner/cmd/osv-scanner/fixtures/go-project -o \
-path temp/GoogleContainerTools/kpt-config-sync/test/docker/presync-webhook-server -o \
-path temp/GoogleContainerTools/skaffold/examples/grpc-e2e-tests/service -o \
-path temp/GoogleContainerTools/skaffold/examples/grpc-e2e-tests/tests -o \
-path temp/GoogleContainerTools/skaffold/integration/examples/grpc-e2e-tests/tests -o \
-path temp/grafana/grafana/.bingo -o \
-path temp/grafana/grafana/devenv -o \
-path temp/grafana/grafana/hack -o \
-path temp/grafana/grafana/scripts -o \
-path temp/grafana/pyroscope/ebpf -o \
-path temp/grafana/pyroscope/examples/\*/golang-push -o \
-path temp/grafana/pyroscope/og -o \
-path temp/hashicorp/consul/internal/tools/proto-gen-rpc-glue/e2e -o \
-path temp/jaegertracing/jaeger/docker/debug -o \
-path temp/kubernetes-sigs/kueue/hack/internal/tools -o \
-path temp/kubernetes-sigs/kueue/site -o \
-path temp/kubernetes/kubernetes/hack/tools -o \
-path temp/kubernetes/kubernetes/staging/src/k8s.io/kms/internal/plugins/_mock -o \
-path temp/launchdarkly/go-server-sdk/ldotel -o \
-path temp/launchdarkly/go-server-sdk/testservice -o \
-path temp/mindersec/minder/tools -o \
-path temp/mvdan/sh/_js -o \
-path temp/reddit/achilles-sdk/tools -o \
-path temp/sigstore/k8s-manifest-sigstore/example -o \
-path temp/sigstore/rekor/hack/tools -o \
-path temp/sigstore/sigstore/hack/tools -o \
-path temp/slack-go/slack/examples/workflow_step -o \
-path temp/tailscale/tailscale/gokrazy/\*/builddir -o \
-path temp/thomaspoignant/go-feature-flag/website/.ci -o \
-path temp/uber-go/mock/bazel -o \
-path temp/vektra/mockery/internal/fixtures/example_project/pkg_with_submodules -o \
-path temp/vektra/mockery/tools \
\) -prune -o \
-name go.mod -execdir "$ZEROLINT" $FLAGS ./... \; 2> "$LOGS/${I}_$j.log"
# else echo "Skipping $i, $j pass..."
fi
done
done