diff options
| author | Tero Marttila <[email protected]> | 2022-06-24 12:34:02 +0300 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-24 12:34:02 +0300 | 
| commit | 44eb5ea262e64fe2d564c7888c9bc5999e43e927 (patch) | |
| tree | 7fd5e03dbd733ea62ae20ed0f770a1befa2265ad | |
| parent | 51b9e521aee6807f4bfcea9b6a38bdbcdb2bc5b1 (diff) | |
| parent | c09c90d0a931888862262a6ed3753eed0af4ddca (diff) | |
Merge pull request #8 from SpComb/github-actions-lint
github workflows: add go fmt, vet checks
| -rwxr-xr-x | .github/workflow-scripts/check-gofmt.sh | 15 | ||||
| -rw-r--r-- | .github/workflows/build.yml | 6 | 
2 files changed, 21 insertions, 0 deletions
diff --git a/.github/workflow-scripts/check-gofmt.sh b/.github/workflow-scripts/check-gofmt.sh new file mode 100755 index 0000000..4e5122a --- /dev/null +++ b/.github/workflow-scripts/check-gofmt.sh @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86d6f70..c210ccc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,12 +25,18 @@ jobs:        - name: Download dependencies          run: go mod download +      - name: Check gofmt +        run: .github/workflow-scripts/check-gofmt.sh . +        - name: Build          run: go build -v        - name: Test          run: go test -v +      - name: Vet +        run: go vet +        - name: Upload          uses: actions/upload-artifact@v3          with:  | 
