2023-03-30 17:04:37 +08:00
|
|
|
---
|
|
|
|
# This action is synced from https://github.com/prometheus/prometheus
|
|
|
|
name: golangci-lint
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths:
|
|
|
|
- "go.sum"
|
|
|
|
- "go.mod"
|
|
|
|
- "**.go"
|
|
|
|
- "scripts/errcheck_excludes.txt"
|
|
|
|
- ".github/workflows/golangci-lint.yml"
|
|
|
|
- ".golangci.yml"
|
|
|
|
pull_request:
|
|
|
|
|
2023-12-14 03:30:06 +08:00
|
|
|
permissions: # added using https://github.com/step-security/secure-repo
|
|
|
|
contents: read
|
|
|
|
|
2023-03-30 17:04:37 +08:00
|
|
|
jobs:
|
|
|
|
golangci:
|
2023-12-14 03:30:06 +08:00
|
|
|
permissions:
|
|
|
|
contents: read # for actions/checkout to fetch code
|
|
|
|
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
2023-03-30 17:04:37 +08:00
|
|
|
name: lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-11-05 23:10:10 +08:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2025-07-11 17:53:32 +08:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2024-05-28 16:06:08 +08:00
|
|
|
- name: Install Go
|
2025-06-02 08:17:37 +08:00
|
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
2023-03-30 17:04:37 +08:00
|
|
|
with:
|
2025-09-02 16:02:39 +08:00
|
|
|
go-version: 1.25.x
|
2023-03-30 17:04:37 +08:00
|
|
|
- name: Install snmp_exporter/generator dependencies
|
|
|
|
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
|
|
|
if: github.repository == 'prometheus/snmp_exporter'
|
2025-09-17 16:52:09 +08:00
|
|
|
- name: Get golangci-lint version
|
|
|
|
id: golangci-lint-version
|
|
|
|
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
|
2023-03-30 17:04:37 +08:00
|
|
|
- name: Lint
|
2025-07-11 17:54:27 +08:00
|
|
|
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
|
2023-03-30 17:04:37 +08:00
|
|
|
with:
|
2024-05-28 16:06:08 +08:00
|
|
|
args: --verbose
|
2025-09-17 16:52:09 +08:00
|
|
|
version: ${{ steps.golangci-lint-version.outputs.version }}
|