mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-18 08:58:30 +00:00
Add gofmt checks to presubmit
This commit is contained in:
parent
b05450b3b3
commit
842af93afa
@ -35,3 +35,14 @@ presubmits:
|
|||||||
- image: quay.io/peridot/ci:v0.3.16
|
- image: quay.io/peridot/ci:v0.3.16
|
||||||
command:
|
command:
|
||||||
- hack/non_manual_build.sh
|
- hack/non_manual_build.sh
|
||||||
|
|
||||||
|
- name: pull-peridot-gofmt-check
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
always_run: true
|
||||||
|
decorate: true
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: quay.io/peridot/ci:v0.3.16
|
||||||
|
command:
|
||||||
|
- hack/gofmt_check.sh
|
||||||
|
15
hack/gofmt_check.sh
Executable file
15
hack/gofmt_check.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
bazel build --config=ci @go_sdk//...
|
||||||
|
|
||||||
|
GO_BIN="$(bazel info output_base)/external/go_sdk/bin/go"
|
||||||
|
|
||||||
|
if [[ -n $($GO_BIN fmt -n $(go list ./... | grep -v /vendor/) | sed 's/ -w//') ]]; then
|
||||||
|
echo "Go files must be formatted with gofmt. Please run:"
|
||||||
|
echo " go fmt $(go list ./... | grep -v /vendor/)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user