| 1 |
--- |
| 2 |
# This action is synced from https://github.com/prometheus/prometheus |
| 3 |
name: golangci-lint |
| 4 |
on: |
| 5 |
push: |
| 6 |
paths: |
| 7 |
- "go.sum" |
| 8 |
- "go.mod" |
| 9 |
- "**.go" |
| 10 |
- "scripts/errcheck_excludes.txt" |
| 11 |
- ".github/workflows/golangci-lint.yml" |
| 12 |
- ".golangci.yml" |
| 13 |
pull_request: |
| 14 |
|
| 15 |
permissions: # added using https://github.com/step-security/secure-repo |
| 16 |
contents: read |
| 17 |
|
| 18 |
jobs: |
| 19 |
golangci: |
| 20 |
permissions: |
| 21 |
contents: read # for actions/checkout to fetch code |
| 22 |
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests |
| 23 |
name: lint |
| 24 |
runs-on: ubuntu-latest |
| 25 |
steps: |
| 26 |
- name: Checkout repository |
| 27 |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 28 |
with: |
| 29 |
persist-credentials: false |
| 30 |
- name: Install Go |
| 31 |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 32 |
with: |
| 33 |
go-version: 1.24.x |
| 34 |
- name: Install snmp_exporter/generator dependencies |
| 35 |
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev |
| 36 |
if: github.repository == 'prometheus/snmp_exporter' |
| 37 |
- name: Lint |
| 38 |
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 |
| 39 |
with: |
| 40 |
args: --verbose |
| 41 |
version: v2.2.1 |