name: Static Check

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

jobs:
  check:
    name: Run Check
    runs-on: ubuntu-latest

    steps:
    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: 1.21.5

    - name: Check out code
      uses: actions/checkout@v3

    - 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 (linux/amd64)
      run: "GOOS=linux GOARCH=amd64 staticcheck ./..."

    - name: Run staticcheck (darwin/amd64)
      run: "GOOS=darwin GOARCH=amd64 staticcheck ./..."
