Merge pull request #8 from SpComb/github-actions-lint
github workflows: add go fmt, vet checks
This commit is contained in:
commit
44eb5ea262
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
fmt_list="$(gofmt -l "$@")"
|
||||||
|
|
||||||
|
if [ -n "$fmt_list" ]; then
|
||||||
|
echo "Check gofmt failed: " >&2
|
||||||
|
|
||||||
|
for file in "$fmt_list"; do
|
||||||
|
echo "::error file=${file},title=gofmt::gofmt check failed"
|
||||||
|
echo "\t$file" >&2
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -25,12 +25,18 @@ jobs:
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
|
- name: Check gofmt
|
||||||
|
run: .github/workflow-scripts/check-gofmt.sh .
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v
|
run: go build -v
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v
|
run: go test -v
|
||||||
|
|
||||||
|
- name: Vet
|
||||||
|
run: go vet
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Reference in New Issue