name: checklocks

on:
  push:
    branches:
      - main
  pull_request:
    paths:
      - '**/*.go'
      - '.github/workflows/checklocks.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  checklocks:
    runs-on: [ ubuntu-latest ]
    steps:
      - name: Check out code
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

      - name: Build checklocks
        run: ./tool/go build -o /tmp/checklocks gvisor.dev/gvisor/tools/checklocks/cmd/checklocks

      - name: Run checklocks vet
        # TODO(#12625): add more packages as we add annotations
        run: |-
          ./tool/go vet -vettool=/tmp/checklocks \
            ./envknob           \
            ./ipn/store/mem     \
            ./net/stun/stuntest \
            ./net/wsconn        \
            ./proxymap
