name: Static Check

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '*'

jobs:
  check:
    name: Run Check
    strategy:
      matrix:
        config:
          - { os: macos-latest, GOOS: darwin }
          - { os: ubuntu-latest, GOOS: linux }
    runs-on: ${{ matrix.config.os }}
    env:
      GOOS: ${{ matrix.config.GOOS }}

    steps:
    - name: Check out code
      uses: actions/checkout@v6
      with:
        fetch-depth: 0

    - name: Set up Go
      uses: ./.github/actions/setup-go

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

    - name: Install staticcheck
      run: "GOBIN=~/.local/bin go install honnef.co/go/tools/cmd/staticcheck@latest"

    - name: Print staticcheck version
      run: "staticcheck -version"

    - name: Run staticcheck (${{ env.GOOS }}/amd64)
      run: "staticcheck ./..."