| 1 |
--- |
| 2 |
|
| 3 |
name: golangci-lint |
| 4 |
on: |
| 5 |
push: |
| 6 |
branches: [main, master, 'release-*'] |
| 7 |
paths: |
| 8 |
- "go.sum" |
| 9 |
- "go.mod" |
| 10 |
- "**.go" |
| 11 |
- "scripts/errcheck_excludes.txt" |
| 12 |
- ".github/workflows/golangci-lint.yml" |
| 13 |
- ".golangci.yml" |
| 14 |
tags: ['v*'] |
| 15 |
pull_request: |
| 16 |
|
| 17 |
permissions: |
| 18 |
contents: read |
| 19 |
|
| 20 |
jobs: |
| 21 |
golangci: |
| 22 |
permissions: |
| 23 |
contents: read |
| 24 |
pull-requests: read |
| 25 |
name: lint |
| 26 |
runs-on: ubuntu-latest |
| 27 |
steps: |
| 28 |
- name: Checkout repository |
| 29 |
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 |
| 30 |
with: |
| 31 |
persist-credentials: false |
| 32 |
- name: Install Go |
| 33 |
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c |
| 34 |
with: |
| 35 |
go-version: 1.26.x |
| 36 |
- name: Install snmp_exporter/generator dependencies |
| 37 |
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev |
| 38 |
if: github.repository == 'prometheus/snmp_exporter' |
| 39 |
- name: Get golangci-lint version |
| 40 |
id: golangci-lint-version |
| 41 |
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT |
| 42 |
- name: Lint |
| 43 |
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee |
| 44 |
with: |
| 45 |
args: --verbose |
| 46 |
version: ${{ steps.golangci-lint-version.outputs.version }} |