Repository: prometheus/procfs
Pull request #442 (2022-04-14 19:48:13)

Fixup linting
* Fix check license issues.
* Ignore some revive naming issues.
* Update minimum Go versions.
* Update go fmt for newer Go versions
* Update Go CI versions.
* Repac fixtures.
* Use cimg/go.

Signed-off-by: SuperQ <superq@gmail.com>


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d563c54..b95e376 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -4,7 +4,7 @@ version: 2.1
 jobs:
   lint:
     docker:
-    - image: cimg/go:1.16
+    - image: cimg/go:1.18
     steps:
     - checkout
     - run: make check_license
@@ -23,7 +23,7 @@ jobs:
         type: boolean
         default: true
     docker:
-    - image: circleci/golang:<< parameters.go_version >>
+    - image: cimg/go:<< parameters.go_version >>
     environment:
       GOOS: "<< parameters.os >>"
     steps:
@@ -54,10 +54,10 @@ workflows:
         matrix:
           parameters:
             go_version:
-            - "1.13"
-            - "1.14"
             - "1.15"
             - "1.16"
+            - "1.17"
+            - "1.18"
     - test:
         name: test-windows
         os: windows
@@ -65,8 +65,8 @@ workflows:
         matrix:
           parameters:
             go_version:
-            - "1.13"
-            - "1.14"
             - "1.15"
             - "1.16"
+            - "1.17"
+            - "1.18"
     - codespell
diff --git a/cpuinfo.go b/cpuinfo.go
index 0c09336..ff6b927 100644
--- a/cpuinfo.go
+++ b/cpuinfo.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package procfs
diff --git a/cpuinfo_armx.go b/cpuinfo_armx.go
index 44b590e..64cfd53 100644
--- a/cpuinfo_armx.go
+++ b/cpuinfo_armx.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && (arm || arm64)
 // +build linux
 // +build arm arm64
 
diff --git a/cpuinfo_mipsx.go b/cpuinfo_mipsx.go
index 91e2725..c11207f 100644
--- a/cpuinfo_mipsx.go
+++ b/cpuinfo_mipsx.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && (mips || mipsle || mips64 || mips64le)
 // +build linux
 // +build mips mipsle mips64 mips64le
 
diff --git a/cpuinfo_others.go b/cpuinfo_others.go
index 95b5b4e..ea41bf2 100644
--- a/cpuinfo_others.go
+++ b/cpuinfo_others.go
@@ -11,8 +11,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// +build linux
-// +build !386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
+//go:build linux && !386 && !amd64 && !arm && !arm64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x
+// +build linux,!386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
 
 package procfs
 
diff --git a/cpuinfo_ppcx.go b/cpuinfo_ppcx.go
index 6068bd5..003bc2a 100644
--- a/cpuinfo_ppcx.go
+++ b/cpuinfo_ppcx.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && (ppc64 || ppc64le)
 // +build linux
 // +build ppc64 ppc64le
 
diff --git a/cpuinfo_riscvx.go b/cpuinfo_riscvx.go
index e83c2e2..1c9b731 100644
--- a/cpuinfo_riscvx.go
+++ b/cpuinfo_riscvx.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && (riscv || riscv64)
 // +build linux
 // +build riscv riscv64
 
diff --git a/cpuinfo_s390x.go b/cpuinfo_s390x.go
index 26814ee..fa3686b 100644
--- a/cpuinfo_s390x.go
+++ b/cpuinfo_s390x.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package procfs
diff --git a/cpuinfo_x86.go b/cpuinfo_x86.go
index d5bedf9..a0ef555 100644
--- a/cpuinfo_x86.go
+++ b/cpuinfo_x86.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && (386 || amd64)
 // +build linux
 // +build 386 amd64
 
diff --git a/fixtures.ttar b/fixtures.ttar
index 0fe1e08..1eedeef 100644
--- a/fixtures.ttar
+++ b/fixtures.ttar
@@ -156,6 +156,14 @@ Inter-|   Receive                                                |  Transmit
   eth0:     438       5    0    0    0     0          0         0      648       8    0    0    0     0       0          0
 Mode: 644
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Path: fixtures/proc/26231/net/netstat
+Lines: 4
+TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps LockDroppedIcmps ArpFilter TW TWRecycled TWKilled PAWSActive PAWSEstab DelayedACKs DelayedACKLocked DelayedACKLost ListenOverflows ListenDrops TCPHPHits TCPPureAcks TCPHPAcks TCPRenoRecovery TCPSackRecovery TCPSACKReneging TCPSACKReorder TCPRenoReorder TCPTSReorder TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures TCPFastRetrans TCPSlowStartRetrans TCPTimeouts TCPLossProbes TCPLossProbeRecovery TCPRenoRecoveryFail TCPSackRecoveryFail TCPRcvCollapsed TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv TCPDSACKOfoRecv TCPAbortOnData TCPAbortOnClose TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger TCPAbortFailed TCPMemoryPressures TCPMemoryPressuresChrono TCPSACKDiscard TCPDSACKIgnoredOld TCPDSACKIgnoredNoUndo TCPSpuriousRTOs TCPMD5NotFound TCPMD5Unexpected TCPMD5Failure TCPSackShifted TCPSackMerged TCPSackShiftFallback TCPBacklogDrop PFMemallocDrop TCPMinTTLDrop TCPDeferAcceptDrop IPReversePathFilter TCPTimeWaitOverflow TCPReqQFullDoCookies TCPReqQFullDrop TCPRetransFail TCPRcvCoalesce TCPOFOQueue TCPOFODrop TCPOFOMerge TCPChallengeACK TCPSYNChallenge TCPFastOpenActive TCPFastOpenActiveFail TCPFastOpenPassive TCPFastOpenPassiveFail TCPFastOpenListenOverflow TCPFastOpenCookieReqd TCPFastOpenBlackhole TCPSpuriousRtxHostQueues BusyPollRxPackets TCPAutoCorking TCPFromZeroWindowAdv TCPToZeroWindowAdv TCPWantZeroWindowAdv TCPSynRetrans TCPOrigDataSent TCPHystartTrainDetect TCPHystartTrainCwnd TCPHystartDelayDetect TCPHystartDelayCwnd TCPACKSkippedSynRecv TCPACKSkippedPAWS TCPACKSkippedSeq TCPACKSkippedFinWait2 TCPACKSkippedTimeWait TCPACKSkippedChallenge TCPWinProbe TCPKeepAlive TCPMTUPFail TCPMTUPSuccess TCPWqueueTooBig
+TcpExt: 0 0 0 1 0 0 0 0 0 0 83 0 0 0 3640 287 1 7460 0 0 134193 1335 829 0 4 0 1 0 0 0 0 1 19 0 0 0 0 3 0 32 100 4 0 0 0 7460 2421 49 1 62 6 0 23 0 7 0 0 0 0 19 2 0 0 0 0 0 6 0 0 0 0 3 0 0 0 0 92425 65515 0 2421 4 4 0 0 0 0 0 0 0 0 0 10 0 0 0 16 2221 0 0 2 45 0 0 3 0 0 0 0 456 0 0 0
+IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts OutBcastPkts InOctets OutOctets InMcastOctets OutMcastOctets InBcastOctets OutBcastOctets InCsumErrors InNoECTPkts InECT1Pkts InECT0Pkts InCEPkts ReasmOverlaps
+IpExt: 0 0 208 214 118 111 190585481 7512674 26093 25903 14546 13628 0 134215 0 0 0 0
+Mode: 644
+# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Path: fixtures/proc/26231/net/snmp
 Lines: 12
 Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
@@ -172,14 +180,6 @@ UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InC
 UdpLite: 0 0 0 0 0 0 0 0
 Mode: 644
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/net/netstat
-Lines: 4
-TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps LockDroppedIcmps ArpFilter TW TWRecycled TWKilled PAWSActive PAWSEstab DelayedACKs DelayedACKLocked DelayedACKLost ListenOverflows ListenDrops TCPHPHits TCPPureAcks TCPHPAcks TCPRenoRecovery TCPSackRecovery TCPSACKReneging TCPSACKReorder TCPRenoReorder TCPTSReorder TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures TCPFastRetrans TCPSlowStartRetrans TCPTimeouts TCPLossProbes TCPLossProbeRecovery TCPRenoRecoveryFail TCPSackRecoveryFail TCPRcvCollapsed TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv TCPDSACKOfoRecv TCPAbortOnData TCPAbortOnClose TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger TCPAbortFailed TCPMemoryPressures TCPMemoryPressuresChrono TCPSACKDiscard TCPDSACKIgnoredOld TCPDSACKIgnoredNoUndo TCPSpuriousRTOs TCPMD5NotFound TCPMD5Unexpected TCPMD5Failure TCPSackShifted TCPSackMerged TCPSackShiftFallback TCPBacklogDrop PFMemallocDrop TCPMinTTLDrop TCPDeferAcceptDrop IPReversePathFilter TCPTimeWaitOverflow TCPReqQFullDoCookies TCPReqQFullDrop TCPRetransFail TCPRcvCoalesce TCPOFOQueue TCPOFODrop TCPOFOMerge TCPChallengeACK TCPSYNChallenge TCPFastOpenActive TCPFastOpenActiveFail TCPFastOpenPassive TCPFastOpenPassiveFail TCPFastOpenListenOverflow TCPFastOpenCookieReqd TCPFastOpenBlackhole TCPSpuriousRtxHostQueues BusyPollRxPackets TCPAutoCorking TCPFromZeroWindowAdv TCPToZeroWindowAdv TCPWantZeroWindowAdv TCPSynRetrans TCPOrigDataSent TCPHystartTrainDetect TCPHystartTrainCwnd TCPHystartDelayDetect TCPHystartDelayCwnd TCPACKSkippedSynRecv TCPACKSkippedPAWS TCPACKSkippedSeq TCPACKSkippedFinWait2 TCPACKSkippedTimeWait TCPACKSkippedChallenge TCPWinProbe TCPKeepAlive TCPMTUPFail TCPMTUPSuccess TCPWqueueTooBig
-TcpExt: 0 0 0 1 0 0 0 0 0 0 83 0 0 0 3640 287 1 7460 0 0 134193 1335 829 0 4 0 1 0 0 0 0 1 19 0 0 0 0 3 0 32 100 4 0 0 0 7460 2421 49 1 62 6 0 23 0 7 0 0 0 0 19 2 0 0 0 0 0 6 0 0 0 0 3 0 0 0 0 92425 65515 0 2421 4 4 0 0 0 0 0 0 0 0 0 10 0 0 0 16 2221 0 0 2 45 0 0 3 0 0 0 0 456 0 0 0
-IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts OutBcastPkts InOctets OutOctets InMcastOctets OutMcastOctets InBcastOctets OutBcastOctets InCsumErrors InNoECTPkts InECT1Pkts InECT0Pkts InCEPkts ReasmOverlaps
-IpExt: 0 0 208 214 118 111 190585481 7512674 26093 25903 14546 13628 0 134215 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Path: fixtures/proc/26231/net/snmp6
 Lines: 92
 Ip6InReceives                   	92166
@@ -274,6 +274,7 @@ UdpLite6RcvbufErrors            	0
 UdpLite6SndbufErrors            	0
 UdpLite6InCsumErrors            	0
 Mode: 644
+Mode: 664
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Directory: fixtures/proc/26231/ns
 Mode: 755
@@ -2773,6 +2774,21 @@ kmem_cache_node      904    928    512   32    4 : tunables    0    0    0 : sla
 kmem_cache           904    936    832   39    8 : tunables    0    0    0 : slabdata     24     24      0
 Mode: 644
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Path: fixtures/proc/softirqs
+Lines: 11
+                    CPU0       CPU1       
+          HI:          3          0
+       TIMER:    2776180     247490
+      NET_TX:       2419        772
+      NET_RX:      55919      28694
+       BLOCK:     174915     262755
+    IRQ_POLL:          0          0
+     TASKLET:        209         75
+       SCHED:    2278692     815209
+     HRTIMER:       1281        220
+         RCU:     605871     532783
+Mode: 444
+# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Path: fixtures/proc/stat
 Lines: 16
 cpu  301854 612 111922 8979004 3552 2 3944 0 0 0
diff --git a/go.mod b/go.mod
index ba6681f..bff0d0b 100644
--- a/go.mod
+++ b/go.mod
@@ -1,9 +1,9 @@
 module github.com/prometheus/procfs
 
-go 1.13
+go 1.15
 
 require (
-	github.com/google/go-cmp v0.5.4
-	golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
-	golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
+	github.com/google/go-cmp v0.5.7
+	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
+	golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
 )
diff --git a/go.sum b/go.sum
index 7ceaf56..e2fe30a 100644
--- a/go.sum
+++ b/go.sum
@@ -1,8 +1,8 @@
-github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
-github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
-golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
-golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
+github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/internal/util/sysreadfile.go b/internal/util/sysreadfile.go
index c07de0b..38e76f9 100644
--- a/internal/util/sysreadfile.go
+++ b/internal/util/sysreadfile.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux && !appengine
 // +build linux,!appengine
 
 package util
diff --git a/internal/util/sysreadfile_compat.go b/internal/util/sysreadfile_compat.go
index bd55b45..8702ab3 100644
--- a/internal/util/sysreadfile_compat.go
+++ b/internal/util/sysreadfile_compat.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build (linux && appengine) || !linux
 // +build linux,appengine !linux
 
 package util
diff --git a/kernel_random.go b/kernel_random.go
index da3a941..db88566 100644
--- a/kernel_random.go
+++ b/kernel_random.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/proc_maps.go b/proc_maps.go
index ddc13b3..f1bcbf3 100644
--- a/proc_maps.go
+++ b/proc_maps.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // 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
 
diff --git a/proc_netstat.go b/proc_netstat.go
index c974b9b..48b5238 100644
--- a/proc_netstat.go
+++ b/proc_netstat.go
@@ -32,7 +32,7 @@ type ProcNetstat struct {
 	IpExt
 }
 
-type TcpExt struct {
+type TcpExt struct { // nolint:revive
 	SyncookiesSent            float64
 	SyncookiesRecv            float64
 	SyncookiesFailed          float64
@@ -147,7 +147,7 @@ type TcpExt struct {
 	TCPWqueueTooBig           float64
 }
 
-type IpExt struct {
+type IpExt struct { // nolint:revive
 	InNoRoutes      float64
 	InTruncatedPkts float64
 	InMcastPkts     float64
@@ -183,7 +183,7 @@ func (p Proc) Netstat() (ProcNetstat, error) {
 // and returns a ProcNetstat structure.
 func parseNetstat(r io.Reader, fileName string) (ProcNetstat, error) {
 	var (
-		scanner  = bufio.NewScanner(r)
+		scanner     = bufio.NewScanner(r)
 		procNetstat = ProcNetstat{}
 	)
 
diff --git a/proc_smaps.go b/proc_smaps.go
index 664b9f1..0e97d99 100644
--- a/proc_smaps.go
+++ b/proc_smaps.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/proc_snmp.go b/proc_snmp.go
index 85438cd..ae19189 100644
--- a/proc_snmp.go
+++ b/proc_snmp.go
@@ -36,7 +36,7 @@ type ProcSnmp struct {
 	UdpLite
 }
 
-type Ip struct {
+type Ip struct { // nolint:revive
 	Forwarding      float64
 	DefaultTTL      float64
 	InReceives      float64
@@ -93,7 +93,7 @@ type IcmpMsg struct {
 	OutType3 float64
 }
 
-type Tcp struct {
+type Tcp struct { // nolint:revive
 	RtoAlgorithm float64
 	RtoMin       float64
 	RtoMax       float64
@@ -111,7 +111,7 @@ type Tcp struct {
 	InCsumErrors float64
 }
 
-type Udp struct {
+type Udp struct { // nolint:revive
 	InDatagrams  float64
 	NoPorts      float64
 	InErrors     float64
@@ -122,7 +122,7 @@ type Udp struct {
 	IgnoredMulti float64
 }
 
-type UdpLite struct {
+type UdpLite struct { // nolint:revive
 	InDatagrams  float64
 	NoPorts      float64
 	InErrors     float64
diff --git a/proc_snmp6.go b/proc_snmp6.go
index 9438995..f611992 100644
--- a/proc_snmp6.go
+++ b/proc_snmp6.go
@@ -35,7 +35,7 @@ type ProcSnmp6 struct {
 	UdpLite6
 }
 
-type Ip6 struct {
+type Ip6 struct { // nolint:revive
 	InReceives       float64
 	InHdrErrors      float64
 	InTooBigErrors   float64
@@ -117,7 +117,7 @@ type Icmp6 struct {
 	OutType143                float64
 }
 
-type Udp6 struct {
+type Udp6 struct { // nolint:revive
 	InDatagrams  float64
 	NoPorts      float64
 	InErrors     float64
@@ -128,7 +128,7 @@ type Udp6 struct {
 	IgnoredMulti float64
 }
 
-type UdpLite6 struct {
+type UdpLite6 struct { // nolint:revive
 	InDatagrams  float64
 	NoPorts      float64
 	InErrors     float64
@@ -160,7 +160,7 @@ func (p Proc) Snmp6() (ProcSnmp6, error) {
 // and returns a map contains those metrics.
 func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) {
 	var (
-		scanner  = bufio.NewScanner(r)
+		scanner   = bufio.NewScanner(r)
 		procSnmp6 = ProcSnmp6{}
 	)
 
diff --git a/softirqs.go b/softirqs.go
new file mode 100644
index 0000000..d27c35f
--- /dev/null
+++ b/softirqs.go
@@ -0,0 +1,160 @@
+// Copyright 2022 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package procfs
+
+import (
+	"bufio"
+	"bytes"
+	"fmt"
+	"io"
+	"strconv"
+	"strings"
+
+	"github.com/prometheus/procfs/internal/util"
+)
+
+// Softirqs represents the softirq statistics.
+type Softirqs struct {
+	Hi      []uint64
+	Timer   []uint64
+	NetTx   []uint64
+	NetRx   []uint64
+	Block   []uint64
+	IRQPoll []uint64
+	Tasklet []uint64
+	Sched   []uint64
+	HRTimer []uint64
+	RCU     []uint64
+}
+
+func (fs FS) Softirqs() (Softirqs, error) {
+	fileName := fs.proc.Path("softirqs")
+	data, err := util.ReadFileNoStat(fileName)
+	if err != nil {
+		return Softirqs{}, err
+	}
+
+	reader := bytes.NewReader(data)
+
+	return parseSoftirqs(reader)
+}
+
+func parseSoftirqs(r io.Reader) (Softirqs, error) {
+	var (
+		softirqs = Softirqs{}
+		scanner  = bufio.NewScanner(r)
+	)
+
+	if !scanner.Scan() {
+		return Softirqs{}, fmt.Errorf("softirqs empty")
+	}
+
+	for scanner.Scan() {
+		parts := strings.Fields(scanner.Text())
+		var err error
+
+		// require at least one cpu
+		if len(parts) < 2 {
+			continue
+		}
+		switch {
+		case parts[0] == "HI:":
+			perCpu := parts[1:]
+			softirqs.Hi = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.Hi[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (HI%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "TIMER:":
+			perCpu := parts[1:]
+			softirqs.Timer = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.Timer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (TIMER%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "NET_TX:":
+			perCpu := parts[1:]
+			softirqs.NetTx = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.NetTx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (NET_TX%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "NET_RX:":
+			perCpu := parts[1:]
+			softirqs.NetRx = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.NetRx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (NET_RX%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "BLOCK:":
+			perCpu := parts[1:]
+			softirqs.Block = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.Block[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (BLOCK%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "IRQ_POLL:":
+			perCpu := parts[1:]
+			softirqs.IRQPoll = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.IRQPoll[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (IRQ_POLL%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "TASKLET:":
+			perCpu := parts[1:]
+			softirqs.Tasklet = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.Tasklet[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (TASKLET%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "SCHED:":
+			perCpu := parts[1:]
+			softirqs.Sched = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.Sched[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (SCHED%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "HRTIMER:":
+			perCpu := parts[1:]
+			softirqs.HRTimer = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.HRTimer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (HRTIMER%d): %w", count, i, err)
+				}
+			}
+		case parts[0] == "RCU:":
+			perCpu := parts[1:]
+			softirqs.RCU = make([]uint64, len(perCpu))
+			for i, count := range perCpu {
+				if softirqs.RCU[i], err = strconv.ParseUint(count, 10, 64); err != nil {
+					return Softirqs{}, fmt.Errorf("couldn't parse %q (RCU%d): %w", count, i, err)
+				}
+			}
+		}
+	}
+
+	if err := scanner.Err(); err != nil {
+		return Softirqs{}, fmt.Errorf("couldn't parse softirqs: %w", err)
+	}
+
+	return softirqs, scanner.Err()
+}
diff --git a/sysfs/class_cooling_device.go b/sysfs/class_cooling_device.go
index a67067f..4bf1d27 100644
--- a/sysfs/class_cooling_device.go
+++ b/sysfs/class_cooling_device.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_dmi.go b/sysfs/class_dmi.go
index 1387853..e556c74 100644
--- a/sysfs/class_dmi.go
+++ b/sysfs/class_dmi.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_drm.go b/sysfs/class_drm.go
index 1febea2..b221e68 100644
--- a/sysfs/class_drm.go
+++ b/sysfs/class_drm.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_drm_amdgpu.go b/sysfs/class_drm_amdgpu.go
index 308d1d1..51b50d0 100644
--- a/sysfs/class_drm_amdgpu.go
+++ b/sysfs/class_drm_amdgpu.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go
index a0c49eb..5d89816 100644
--- a/sysfs/class_fibrechannel.go
+++ b/sysfs/class_fibrechannel.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go
index 7b7a86f..17b9862 100644
--- a/sysfs/class_infiniband.go
+++ b/sysfs/class_infiniband.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_nvme.go b/sysfs/class_nvme.go
index 2e4fa34..5daf150 100644
--- a/sysfs/class_nvme.go
+++ b/sysfs/class_nvme.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_power_supply.go b/sysfs/class_power_supply.go
index 4ca8165..2199de4 100644
--- a/sysfs/class_power_supply.go
+++ b/sysfs/class_power_supply.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_powercap.go b/sysfs/class_powercap.go
index f032190..d1434a2 100644
--- a/sysfs/class_powercap.go
+++ b/sysfs/class_powercap.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_scsitape.go b/sysfs/class_scsitape.go
index 371b4ae..b2d4ba5 100644
--- a/sysfs/class_scsitape.go
+++ b/sysfs/class_scsitape.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_thermal.go b/sysfs/class_thermal.go
index 6b4823e..0935a21 100644
--- a/sysfs/class_thermal.go
+++ b/sysfs/class_thermal.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/clocksource.go b/sysfs/clocksource.go
index ac50739..bb3a842 100644
--- a/sysfs/clocksource.go
+++ b/sysfs/clocksource.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/doc.go b/sysfs/doc.go
index cb251c8..dc96344 100644
--- a/sysfs/doc.go
+++ b/sysfs/doc.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 // Package sysfs provides functions to retrieve system and kernel metrics
diff --git a/sysfs/fs.go b/sysfs/fs.go
index c11e9a6..b8ee21d 100644
--- a/sysfs/fs.go
+++ b/sysfs/fs.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/net_class.go b/sysfs/net_class.go
index 6dff98e..940b4e4 100644
--- a/sysfs/net_class.go
+++ b/sysfs/net_class.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go
index 7c46c2e..ed975ba 100644
--- a/sysfs/system_cpu.go
+++ b/sysfs/system_cpu.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/vmstat_numa.go b/sysfs/vmstat_numa.go
index f33ef08..8a6d095 100644
--- a/sysfs/vmstat_numa.go
+++ b/sysfs/vmstat_numa.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/vulnerability.go b/sysfs/vulnerability.go
index 477135f..721948f 100644
--- a/sysfs/vulnerability.go
+++ b/sysfs/vulnerability.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/vm.go b/vm.go
index f53f98e..a03768a 100644
--- a/vm.go
+++ b/vm.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/zoneinfo.go b/zoneinfo.go
index 209e2ac..33ddf68 100644
--- a/zoneinfo.go
+++ b/zoneinfo.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs


Test patch:
diff --git a/cmdline_test.go b/cmdline_test.go
index f9cc1b8..4eb433f 100644
--- a/cmdline_test.go
+++ b/cmdline_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package procfs
diff --git a/cpuinfo_test.go b/cpuinfo_test.go
index 9a00d69..c339fea 100644
--- a/cpuinfo_test.go
+++ b/cpuinfo_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package procfs
diff --git a/kernel_random_test.go b/kernel_random_test.go
index da9b93c..fcd85c8 100644
--- a/kernel_random_test.go
+++ b/kernel_random_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/proc_maps32_test.go b/proc_maps32_test.go
index 87be972..77444c4 100644
--- a/proc_maps32_test.go
+++ b/proc_maps32_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // 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
 
diff --git a/proc_maps64_test.go b/proc_maps64_test.go
index 11234a4..66ef134 100644
--- a/proc_maps64_test.go
+++ b/proc_maps64_test.go
@@ -11,8 +11,12 @@
 // See the License for the specific language governing permissions and
 // 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
+// +build !386
+// +build !arm
+// +build !mips
+// +build !mipsle
 
 package procfs
 
diff --git a/proc_netstat_test.go b/proc_netstat_test.go
index 3a0ed31..6cb9af2 100644
--- a/proc_netstat_test.go
+++ b/proc_netstat_test.go
@@ -1,3 +1,16 @@
+// Copyright 2022 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package procfs
 
 import (
diff --git a/proc_smaps_test.go b/proc_smaps_test.go
index bedb1cf..b11b98f 100644
--- a/proc_smaps_test.go
+++ b/proc_smaps_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/proc_snmp6_test.go b/proc_snmp6_test.go
index c3a55bf..aed483e 100644
--- a/proc_snmp6_test.go
+++ b/proc_snmp6_test.go
@@ -1,3 +1,16 @@
+// Copyright 2022 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package procfs
 
 import "testing"
diff --git a/softirqs_test.go b/softirqs_test.go
new file mode 100644
index 0000000..bf32af2
--- /dev/null
+++ b/softirqs_test.go
@@ -0,0 +1,64 @@
+// Copyright 2022 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package procfs
+
+import "testing"
+
+func TestSoftirqs(t *testing.T) {
+	s, err := getProcFixtures(t).Softirqs()
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	// hi
+	if want, have := uint64(3), s.Hi[0]; want != have {
+		t.Errorf("want softirq HI count %d, have %d", want, have)
+	}
+	// timer
+	if want, have := uint64(247490), s.Timer[1]; want != have {
+		t.Errorf("want softirq TIMER count %d, have %d", want, have)
+	}
+	// net_tx
+	if want, have := uint64(2419), s.NetTx[0]; want != have {
+		t.Errorf("want softirq NET_TX count %d, have %d", want, have)
+	}
+	// net_rx
+	if want, have := uint64(28694), s.NetRx[1]; want != have {
+		t.Errorf("want softirq NET_RX count %d, have %d", want, have)
+	}
+	// block
+	if want, have := uint64(262755), s.Block[1]; want != have {
+		t.Errorf("want softirq BLOCK count %d, have %d", want, have)
+	}
+	// irq_poll
+	if want, have := uint64(0), s.IRQPoll[0]; want != have {
+		t.Errorf("want softirq IRQ_POLL count %d, have %d", want, have)
+	}
+	// tasklet
+	if want, have := uint64(209), s.Tasklet[0]; want != have {
+		t.Errorf("want softirq TASKLET count %d, have %d", want, have)
+	}
+	// sched
+	if want, have := uint64(2278692), s.Sched[0]; want != have {
+		t.Errorf("want softirq SCHED count %d, have %d", want, have)
+	}
+	// hrtimer
+	if want, have := uint64(1281), s.HRTimer[0]; want != have {
+		t.Errorf("want softirq HRTIMER count %d, have %d", want, have)
+	}
+	// rcu
+	if want, have := uint64(532783), s.RCU[1]; want != have {
+		t.Errorf("want softirq RCU count %d, have %d", want, have)
+	}
+}
diff --git a/sysfs/class_cooling_device_test.go b/sysfs/class_cooling_device_test.go
index 7555d38..0c7c497 100644
--- a/sysfs/class_cooling_device_test.go
+++ b/sysfs/class_cooling_device_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_dmi_test.go b/sysfs/class_dmi_test.go
index 9e3d118..a149ef4 100644
--- a/sysfs/class_dmi_test.go
+++ b/sysfs/class_dmi_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_drm_amdgpu_test.go b/sysfs/class_drm_amdgpu_test.go
index 902764e..c219ccd 100644
--- a/sysfs/class_drm_amdgpu_test.go
+++ b/sysfs/class_drm_amdgpu_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_fibrechannel_test.go b/sysfs/class_fibrechannel_test.go
index 5693718..7181795 100644
--- a/sysfs/class_fibrechannel_test.go
+++ b/sysfs/class_fibrechannel_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_infiniband_test.go b/sysfs/class_infiniband_test.go
index 79f4b1f..acb6263 100644
--- a/sysfs/class_infiniband_test.go
+++ b/sysfs/class_infiniband_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_nvme_test.go b/sysfs/class_nvme_test.go
index 8841447..3867be8 100644
--- a/sysfs/class_nvme_test.go
+++ b/sysfs/class_nvme_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_power_supply_test.go b/sysfs/class_power_supply_test.go
index a83e595..5264149 100644
--- a/sysfs/class_power_supply_test.go
+++ b/sysfs/class_power_supply_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_powercap_test.go b/sysfs/class_powercap_test.go
index c78d1c5..4122a9d 100644
--- a/sysfs/class_powercap_test.go
+++ b/sysfs/class_powercap_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_scsitape_test.go b/sysfs/class_scsitape_test.go
index 17480d4..1ab81b1 100644
--- a/sysfs/class_scsitape_test.go
+++ b/sysfs/class_scsitape_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/class_thermal_test.go b/sysfs/class_thermal_test.go
index 0bce736..7d54fb1 100644
--- a/sysfs/class_thermal_test.go
+++ b/sysfs/class_thermal_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/clocksource_test.go b/sysfs/clocksource_test.go
index 7c38d4b..d2ebc90 100644
--- a/sysfs/clocksource_test.go
+++ b/sysfs/clocksource_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/fs_test.go b/sysfs/fs_test.go
index 7745fbe..37ffe7d 100644
--- a/sysfs/fs_test.go
+++ b/sysfs/fs_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/net_class_test.go b/sysfs/net_class_test.go
index f856607..4784fe4 100644
--- a/sysfs/net_class_test.go
+++ b/sysfs/net_class_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/system_cpu_test.go b/sysfs/system_cpu_test.go
index 0ae9f0f..afce58d 100644
--- a/sysfs/system_cpu_test.go
+++ b/sysfs/system_cpu_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/sysfs/vmstat_numa_test.go b/sysfs/vmstat_numa_test.go
index 81c0a18..9b48987 100644
--- a/sysfs/vmstat_numa_test.go
+++ b/sysfs/vmstat_numa_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build linux
 // +build linux
 
 package sysfs
diff --git a/vm_test.go b/vm_test.go
index 988f9a1..4bf4052 100644
--- a/vm_test.go
+++ b/vm_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs
diff --git a/zoneinfo_test.go b/zoneinfo_test.go
index f643980..da55744 100644
--- a/zoneinfo_test.go
+++ b/zoneinfo_test.go
@@ -11,6 +11,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !windows
 // +build !windows
 
 package procfs