name: Static Analysis

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  check:
    runs-on: ubuntu-latest

    steps:
    - name: Install Go
      uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
      with:
        go-version: '1.19'

    - name: Check out code
      uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

    - name: Install staticcheck
      run: go install honnef.co/go/tools/cmd/staticcheck@latest

    - name: Run staticcheck
      run: |
        staticcheck -version
        staticcheck -- ./...

    - name: Run go vet
      run: go vet ./...
