kubo/.github/workflows/golang-analysis.yml
2022-09-09 17:09:38 +02:00

39 lines
1.1 KiB
YAML

on: [push, pull_request]
name: Go Checks
jobs:
unit:
runs-on: ubuntu-latest
name: All
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: "1.19.x"
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.2
with:
run: |
go mod tidy
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
echo "go.sum was added by go mod tidy"
exit 1
fi
git diff --exit-code -- go.sum go.mod
- name: go fmt
if: always() # run this step even if the previous one failed
run: |
out=$(go fmt ./...)
if [[ -n "$out" ]]; then
echo "Files are not go-fmt-ed:"
echo "$out"
exit 1
fi
- name: go vet
if: always() # run this step even if the previous one failed
uses: protocol/multiple-go-modules@v1.2
with:
run: go vet ./...