Skip to content

Commit 3cc6dc9

Browse files
thevilledevdiscordianfish
authored andcommitted
fix: correct linters-settings typo in .golangci.yml
The linter configuration had a typo ("linter-settings" instead of "linters-settings"), which prevented linter rules from being applied. Fixing this revealed and resolved multiple style issues across the codebase: - Renamed shadowing parameter in `net_unix.go` - Fixed import grouping in `valueparser_test.go` - Corrected comment capitalization and spelling - Unused parameters Signed-off-by: Ville Vesilehto <[email protected]>
1 parent 88acb09 commit 3cc6dc9

13 files changed

+23
-22
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ linters:
1515
- testifylint
1616
- unused
1717

18-
linter-settings:
18+
linters-settings:
1919
forbidigo:
2020
forbid:
2121
- p: ^fmt\.Print.*$

arp.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323

2424
// Learned from include/uapi/linux/if_arp.h.
2525
const (
26-
// completed entry (ha valid).
26+
// Completed entry (ha valid).
2727
ATFComplete = 0x02
28-
// permanent entry.
28+
// Permanent entry.
2929
ATFPermanent = 0x04
3030
// Publish entry.
3131
ATFPublish = 0x08

bcache/get.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (fs FS) StatsWithoutPriority() ([]*Stats, error) {
6262
return fs.stats(false)
6363
}
6464

65-
// stats() retrieves bcache runtime statistics for each bcache.
65+
// stats retrieves bcache runtime statistics for each bcache and
6666
// priorityStats flag controls if we need to read priority_stats.
6767
func (fs FS) stats(priorityStats bool) ([]*Stats, error) {
6868
matches, err := filepath.Glob(fs.sys.Path("fs/bcache/*-*"))

blockdevice/stats.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf
483483

484484
}
485485

486-
// SysBlockDeviceSize returns the size of the block device from /sys/block/<device>/size.
486+
// SysBlockDeviceSize returns the size of the block device from /sys/block/<device>/size
487487
// in bytes by multiplying the value by the Linux sector length of 512.
488488
func (fs FS) SysBlockDeviceSize(device string) (uint64, error) {
489489
size, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockSize))

fs_statfs_notype.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package procfs
1818

1919
// isRealProc returns true on architectures that don't have a Type argument
20-
// in their Statfs_t struct
21-
func isRealProc(mountPoint string) (bool, error) {
20+
// in their Statfs_t struct.
21+
func isRealProc(_ string) (bool, error) {
2222
return true, nil
2323
}

fscache.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ type Fscacheinfo struct {
162162
ReleaseRequestsAgainstPagesStoredByTimeLockGranted uint64
163163
// Number of release reqs ignored due to in-progress store
164164
ReleaseRequestsIgnoredDueToInProgressStore uint64
165-
// Number of page stores cancelled due to release req
165+
// Number of page stores canceled due to release req
166166
PageStoresCancelledByReleaseRequests uint64
167167
VmscanWaiting uint64
168168
// Number of times async ops added to pending queues
@@ -171,11 +171,11 @@ type Fscacheinfo struct {
171171
OpsRunning uint64
172172
// Number of times async ops queued for processing
173173
OpsEnqueued uint64
174-
// Number of async ops cancelled
174+
// Number of async ops canceled
175175
OpsCancelled uint64
176176
// Number of async ops rejected due to object lookup/create failure
177177
OpsRejected uint64
178-
// Number of async ops initialised
178+
// Number of async ops initialized
179179
OpsInitialised uint64
180180
// Number of async ops queued for deferred release
181181
OpsDeferred uint64

internal/util/valueparser_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"testing"
1818

1919
"github.com/google/go-cmp/cmp"
20+
2021
"github.com/prometheus/procfs/internal/util"
2122
)
2223

mountstats.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ const (
4545
fieldTransport11TCPLen = 13
4646
fieldTransport11UDPLen = 10
4747

48-
// kernel version >= 4.14 MaxLen
48+
// Kernel version >= 4.14 MaxLen
4949
// See: https://elixir.bootlin.com/linux/v6.4.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L393
5050
fieldTransport11RDMAMaxLen = 28
5151

52-
// kernel version <= 4.2 MinLen
52+
// Kernel version <= 4.2 MinLen
5353
// See: https://elixir.bootlin.com/linux/v4.2.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L331
5454
fieldTransport11RDMAMinLen = 20
5555
)

net_ip_socket.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
const (
28-
// readLimit is used by io.LimitReader while reading the content of the
28+
// Maximum size limit used by io.LimitReader while reading the content of the
2929
// /proc/net/udp{,6} files. The number of lines inside such a file is dynamic
3030
// as each line represents a single used socket.
3131
// In theory, the number of available sockets is 65535 (2^16 - 1) per IP.
@@ -54,8 +54,8 @@ type (
5454
Drops *uint64
5555
}
5656

57-
// netIPSocketLine represents the fields parsed from a single line
58-
// in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped.
57+
// A single line parser for fields from /proc/net/{t,u}dp{,6}.
58+
// Fields which are not used by IPSocket are skipped.
5959
// Drops is non-nil for udp{,6}, but nil for tcp{,6}.
6060
// For the proc file format details, see https://linux.die.net/man/5/proc.
6161
netIPSocketLine struct {

net_unix.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ func parseNetUNIX(r io.Reader) (*NetUNIX, error) {
121121
return &nu, nil
122122
}
123123

124-
func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, error) {
124+
func (u *NetUNIX) parseLine(line string, hasInode bool, minFields int) (*NetUNIXLine, error) {
125125
fields := strings.Fields(line)
126126

127127
l := len(fields)
128-
if l < min {
129-
return nil, fmt.Errorf("%w: expected at least %d fields but got %d", ErrFileParse, min, l)
128+
if l < minFields {
129+
return nil, fmt.Errorf("%w: expected at least %d fields but got %d", ErrFileParse, minFields, l)
130130
}
131131

132132
// Field offsets are as follows:
@@ -172,7 +172,7 @@ func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine,
172172
}
173173

174174
// Path field is optional.
175-
if l > min {
175+
if l > minFields {
176176
// Path occurs at either index 6 or 7 depending on whether inode is
177177
// already present.
178178
pathIdx := 7

proc_cgroup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
// Cgroup models one line from /proc/[pid]/cgroup. Each Cgroup struct describes the placement of a PID inside a
27-
// specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. v1 has one hierarchy per available resource
27+
// specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. The v1 has one hierarchy per available resource
2828
// controller, while v2 has one unified hierarchy shared by all controllers. Regardless of v1 or v2, all hierarchies
2929
// contain all running processes, so the question answerable with a Cgroup struct is 'where is this process in
3030
// this hierarchy' (where==what path on the specific cgroupfs). By prefixing this path with the mount point of

proc_io.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (p Proc) IO() (ProcIO, error) {
5050

5151
ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" +
5252
"read_bytes: %d\nwrite_bytes: %d\n" +
53-
"cancelled_write_bytes: %d\n"
53+
"cancelled_write_bytes: %d\n" //nolint:misspell
5454

5555
_, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR,
5656
&pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes)

proc_smaps.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
var (
31-
// match the header line before each mapped zone in `/proc/pid/smaps`.
31+
// Match the header line before each mapped zone in `/proc/pid/smaps`.
3232
procSMapsHeaderLine = regexp.MustCompile(`^[a-f0-9].*$`)
3333
)
3434

0 commit comments

Comments
 (0)