summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/vet.yml
blob: c03190e4fcf1a2fe0ad7c8b254aeb511ce974096 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: tailscale.com/cmd/vet

env:
  HOME: ${{ github.workspace }}
  # GOMODCACHE is the same definition on all OSes. Within the workspace, we use
  # toplevel directories "src" (for the checked out source code), and "gomodcache"
  # and other caches as siblings to follow.
  GOMODCACHE: ${{ github.workspace }}/gomodcache
  CMD_GO_USE_GIT_HASH: "true"

on:
  push:
    branches:
      - main
      - "release-branch/*"
    paths:
      - "**.go"
  pull_request:
    paths:
      - "**.go"

jobs:
  vet:
    runs-on: [ self-hosted, linux ]
    timeout-minutes: 5

    steps:
      - name: Check out code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          path: src

      - name: Build 'go vet' tool
        working-directory: src
        run: ./tool/go build -o /tmp/vettool tailscale.com/cmd/vet

      - name: Run 'go vet'
        working-directory: src
        # Use listpkgs --ignore-3p to skip tempfork/ packages, which
        # intentionally match upstream and may not follow our style rules.
        # Must use ./... instead of tailscale.com/... because the latter will
        # include the v2 go client (tailscale.com/client/tailscale/v2) if it's
        # a dependency in our go.mod file. Possibly a go vet bug, but avoid
        # cross-repo vetting for now so we can safely add the dependency.
        run: ./tool/go vet -vettool=/tmp/vettool $(./tool/go run ./tool/listpkgs --ignore-3p ./...)