Skip to content

Commit cb43228

Browse files
authored
Merge pull request #8756 from jackfrancis/gha-for-go-proj
[cluster-autoscaler-1.34] update hack/for-go-proj.sh
2 parents ff8aecb + b7c076b commit cb43228

File tree

1 file changed

+24
-43
lines changed

1 file changed

+24
-43
lines changed

hack/for-go-proj.sh

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,58 +19,39 @@ set -o pipefail
1919
set -o nounset
2020

2121
CONTRIB_ROOT="$(dirname ${BASH_SOURCE})/.."
22-
PROJECT_NAMES=(addon-resizer vertical-pod-autoscaler)
2322

2423
if [[ $# -ne 1 ]]; then
25-
echo "missing subcommand: [build|install|test]"
24+
echo "missing subcommand: [cluster-autoscaler|vertical-pod-autoscaler|addon-resizer]"
2625
exit 1
2726
fi
2827

29-
CMD="${1}"
30-
31-
case "${CMD}" in
32-
"build")
28+
PROJECT="${1}"
29+
30+
case "${PROJECT}" in
31+
"cluster-autoscaler")
32+
pushd ${CONTRIB_ROOT}/cluster-autoscaler/
33+
# TODO: #8127 - Use default analyzers set by `go test` to include `printf` analyzer.
34+
# Default analyzers that go test runs according to https://github.com/golang/go/blob/52624e533fe52329da5ba6ebb9c37712048168e0/src/cmd/go/internal/test/test.go#L649
35+
# This doesn't include the `printf` analyzer until cluster-autoscaler libraries are updated.
36+
ANALYZERS="atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests"
37+
go test -count=1 ./... -vet="${ANALYZERS}"
38+
popd
3339
;;
34-
"install")
40+
"vertical-pod-autoscaler")
41+
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler
42+
go test -count=1 -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e | grep -v cluster-autoscaler/apis)
43+
popd
44+
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler/e2e
45+
go test -run=None ./...
46+
popd
3547
;;
36-
"test")
48+
"addon-resizer")
49+
pushd ${CONTRIB_ROOT}/addon-resizer
50+
godep go test -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e)
51+
popd
3752
;;
3853
*)
3954
echo "invalid subcommand: ${CMD}"
4055
exit 1
4156
;;
42-
esac
43-
44-
for project_name in ${PROJECT_NAMES[*]}; do
45-
(
46-
export GO111MODULE=auto
47-
project=${CONTRIB_ROOT}/${project_name}
48-
echo "${CMD}ing ${project}"
49-
cd "${project}"
50-
case "${CMD}" in
51-
"test")
52-
if [[ -n $(find . -name "Godeps.json") ]]; then
53-
godep go test -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e)
54-
else
55-
go test -count=1 -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e | grep -v cluster-autoscaler/apis)
56-
fi
57-
;;
58-
*)
59-
godep go "${CMD}" ./...
60-
;;
61-
esac
62-
)
63-
done;
64-
65-
if [ "${CMD}" = "build" ] || [ "${CMD}" == "test" ]; then
66-
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler/e2e
67-
go test -run=None ./...
68-
popd
69-
pushd ${CONTRIB_ROOT}/cluster-autoscaler/
70-
# TODO: #8127 - Use default analyzers set by `go test` to include `printf` analyzer.
71-
# Default analyzers that go test runs according to https://github.com/golang/go/blob/52624e533fe52329da5ba6ebb9c37712048168e0/src/cmd/go/internal/test/test.go#L649
72-
# This doesn't include the `printf` analyzer until cluster-autoscaler libraries are updated.
73-
ANALYZERS="atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests"
74-
go test -count=1 ./... -vet="${ANALYZERS}"
75-
popd
76-
fi
57+
esac

0 commit comments

Comments
 (0)