Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
go-version: 1.25.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Get golangci-lint version
id: golangci-lint-version
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
- name: Lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
args: --verbose
version: v2.1.5
version: ${{ steps.golangci-lint-version.outputs.version }}
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ linters:
capital: true
misspell:
locale: US
revive:
rules:
- name: var-naming
disabled: true
exclusions:
presets:
- comments
Expand Down
6 changes: 5 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v2.1.5
GOLANGCI_LINT_VERSION ?= v2.4.0
GOLANGCI_FMT_OPTS ?=
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
Expand Down Expand Up @@ -266,6 +266,10 @@ $(GOLANGCI_LINT):
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
endif

.PHONY: common-print-golangci-lint-version
common-print-golangci-lint-version:
@echo $(GOLANGCI_LINT_VERSION)

.PHONY: precheck
precheck::

Expand Down
1 change: 0 additions & 1 deletion cmdline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package procfs

Expand Down
1 change: 0 additions & 1 deletion cpuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package procfs

Expand Down
2 changes: 0 additions & 2 deletions cpuinfo_armx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build linux && (arm || arm64)
// +build linux
// +build arm arm64

package procfs

Expand Down
1 change: 0 additions & 1 deletion cpuinfo_loong64.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package procfs

Expand Down
2 changes: 0 additions & 2 deletions cpuinfo_mipsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build linux && (mips || mipsle || mips64 || mips64le)
// +build linux
// +build mips mipsle mips64 mips64le

package procfs

Expand Down
1 change: 0 additions & 1 deletion cpuinfo_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !386 && !amd64 && !arm && !arm64 && !loong64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x
// +build linux,!386,!amd64,!arm,!arm64,!loong64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x

package procfs

Expand Down
2 changes: 0 additions & 2 deletions cpuinfo_ppcx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le

package procfs

Expand Down
2 changes: 0 additions & 2 deletions cpuinfo_riscvx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build linux && (riscv || riscv64)
// +build linux
// +build riscv riscv64

package procfs

Expand Down
1 change: 0 additions & 1 deletion cpuinfo_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package procfs

Expand Down
1 change: 0 additions & 1 deletion cpuinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package procfs

Expand Down
2 changes: 0 additions & 2 deletions cpuinfo_x86.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build linux && (386 || amd64)
// +build linux
// +build 386 amd64

package procfs

Expand Down
1 change: 0 additions & 1 deletion fs_statfs_notype.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !freebsd && !linux
// +build !freebsd,!linux

package procfs

Expand Down
1 change: 0 additions & 1 deletion fs_statfs_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build freebsd || linux
// +build freebsd linux

package procfs

Expand Down
2 changes: 0 additions & 2 deletions internal/util/sysreadfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build (linux || darwin) && !appengine
// +build linux darwin
// +build !appengine

package util

Expand Down
1 change: 0 additions & 1 deletion internal/util/sysreadfile_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build (linux && appengine) || (!linux && !darwin)
// +build linux,appengine !linux,!darwin

package util

Expand Down
1 change: 0 additions & 1 deletion kernel_hung.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
1 change: 0 additions & 1 deletion kernel_hung_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
1 change: 0 additions & 1 deletion kernel_random.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
1 change: 0 additions & 1 deletion kernel_random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
2 changes: 0 additions & 2 deletions proc_maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !js
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !js

package procfs

Expand Down
2 changes: 0 additions & 2 deletions proc_maps32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && (386 || arm || mips || mipsle)
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build 386 arm mips mipsle

package procfs

Expand Down
5 changes: 0 additions & 5 deletions proc_maps64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
// limitations under the License.

//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !386 && !arm && !mips && !mipsle
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !386
// +build !arm
// +build !mips
// +build !mipsle

package procfs

Expand Down
1 change: 0 additions & 1 deletion proc_smaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
1 change: 0 additions & 1 deletion proc_smaps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build !windows
// +build !windows

package procfs

Expand Down
2 changes: 1 addition & 1 deletion scripts/check_build_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

fail=0
while read -r f ; do
if ! grep -q '+build linux' "$f" ; then
if ! grep -q '//go:build linux' "$f" ; then
echo "missing linux build tag: $f"
fail=1
fi
Expand Down
1 change: 0 additions & 1 deletion selinuxfs/avc_cache_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion selinuxfs/avc_cache_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion selinuxfs/avc_hash_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion selinuxfs/avc_hash_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion selinuxfs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion selinuxfs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux && !noselinux
// +build linux,!noselinux

package selinuxfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_cooling_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_cooling_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_dmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_dmi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_drm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_drm_amdgpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_drm_amdgpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_drm_card.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_drm_card_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
1 change: 0 additions & 1 deletion sysfs/class_fibrechannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.

//go:build linux
// +build linux

package sysfs

Expand Down
Loading