Skip to content

Commit 103801b

Browse files
committed
chore: enable unused-parameter from revive
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent edcde3a commit 103801b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+392
-393
lines changed

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ linters-settings:
9494
disabled: true
9595
- name: unreachable-code
9696
- name: unused-parameter
97-
disabled: true
9897
- name: use-any
9998
- name: var-declaration
10099
- name: var-naming

cpu/cpu_aix_nocgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
148148
return []InfoStat{ret}, nil
149149
}
150150

151-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
151+
func CountsWithContext(ctx context.Context, _ bool) (int, error) {
152152
info, err := InfoWithContext(ctx)
153153
if err == nil {
154154
return int(info[0].Cores), nil

cpu/cpu_darwin.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Times(percpu bool) ([]TimesStat, error) {
5959
return TimesWithContext(context.Background(), percpu)
6060
}
6161

62-
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
62+
func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
6363
lib, err := common.NewLibrary(common.System)
6464
if err != nil {
6565
return nil, err
@@ -78,7 +78,7 @@ func Info() ([]InfoStat, error) {
7878
return InfoWithContext(context.Background())
7979
}
8080

81-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
81+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
8282
var ret []InfoStat
8383

8484
c := InfoStat{}
@@ -121,7 +121,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
121121
return append(ret, c), nil
122122
}
123123

124-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
124+
func CountsWithContext(_ context.Context, logical bool) (int, error) {
125125
var cpuArgument string
126126
if logical {
127127
cpuArgument = "hw.logicalcpu"

cpu/cpu_dragonfly.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func Times(percpu bool) ([]TimesStat, error) {
5151
return TimesWithContext(context.Background(), percpu)
5252
}
5353

54-
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
54+
func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
5555
if percpu {
5656
buf, err := unix.SysctlRaw("kern.cp_times")
5757
if err != nil {
@@ -92,7 +92,7 @@ func Info() ([]InfoStat, error) {
9292
return InfoWithContext(context.Background())
9393
}
9494

95-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
95+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
9696
const dmesgBoot = "/var/run/dmesg.boot"
9797

9898
c, err := parseDmesgBoot(dmesgBoot)
@@ -153,6 +153,6 @@ func parseDmesgBoot(fileName string) (InfoStat, error) {
153153
return c, nil
154154
}
155155

156-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
156+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
157157
return runtime.NumCPU(), nil
158158
}

cpu/cpu_freebsd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func Times(percpu bool) ([]TimesStat, error) {
5252
return TimesWithContext(context.Background(), percpu)
5353
}
5454

55-
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
55+
func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
5656
if percpu {
5757
buf, err := unix.SysctlRaw("kern.cp_times")
5858
if err != nil {
@@ -93,7 +93,7 @@ func Info() ([]InfoStat, error) {
9393
return InfoWithContext(context.Background())
9494
}
9595

96-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
96+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
9797
const dmesgBoot = "/var/run/dmesg.boot"
9898

9999
c, num, err := parseDmesgBoot(dmesgBoot)
@@ -165,6 +165,6 @@ func parseDmesgBoot(fileName string) (InfoStat, int, error) {
165165
return c, cpuNum, nil
166166
}
167167

168-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
168+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
169169
return runtime.NumCPU(), nil
170170
}

cpu/cpu_netbsd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Times(percpu bool) ([]TimesStat, error) {
3636
return TimesWithContext(context.Background(), percpu)
3737
}
3838

39-
func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) {
39+
func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) {
4040
if !percpu {
4141
mib := []int32{ctlKern, kernCpTime}
4242
buf, _, err := common.CallSyscall(mib)
@@ -87,7 +87,7 @@ func Info() ([]InfoStat, error) {
8787
return InfoWithContext(context.Background())
8888
}
8989

90-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
90+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
9191
var ret []InfoStat
9292
var err error
9393

@@ -115,6 +115,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
115115
return append(ret, c), nil
116116
}
117117

118-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
118+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
119119
return runtime.NumCPU(), nil
120120
}

cpu/cpu_openbsd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func Times(percpu bool) ([]TimesStat, error) {
5454
return TimesWithContext(context.Background(), percpu)
5555
}
5656

57-
func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) {
57+
func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) {
5858
if !percpu {
5959
mib := []int32{ctlKern, kernCpTime}
6060
buf, _, err := common.CallSyscall(mib)
@@ -108,7 +108,7 @@ func Info() ([]InfoStat, error) {
108108
return InfoWithContext(context.Background())
109109
}
110110

111-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
111+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
112112
var ret []InfoStat
113113
var err error
114114

@@ -133,6 +133,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
133133
return append(ret, c), nil
134134
}
135135

136-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
136+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
137137
return runtime.NumCPU(), nil
138138
}

cpu/cpu_plan9.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func Times(percpu bool) ([]TimesStat, error) {
1717
return TimesWithContext(context.Background(), percpu)
1818
}
1919

20-
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
20+
func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) {
2121
// BUG: percpu flag is not supported yet.
2222
root := os.Getenv("HOST_ROOT")
2323
c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root))
@@ -42,10 +42,10 @@ func Info() ([]InfoStat, error) {
4242
return InfoWithContext(context.Background())
4343
}
4444

45-
func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
45+
func InfoWithContext(_ context.Context) ([]InfoStat, error) {
4646
return []InfoStat{}, common.ErrNotImplementedError
4747
}
4848

49-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
49+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
5050
return runtime.NumCPU(), nil
5151
}

cpu/cpu_solaris.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,6 @@ func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) {
265265
return result, nil
266266
}
267267

268-
func CountsWithContext(ctx context.Context, logical bool) (int, error) {
268+
func CountsWithContext(_ context.Context, _ bool) (int, error) {
269269
return runtime.NumCPU(), nil
270270
}

cpu/cpu_windows.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func Times(percpu bool) ([]TimesStat, error) {
5858
return TimesWithContext(context.Background(), percpu)
5959
}
6060

61-
func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
61+
func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) {
6262
if percpu {
6363
return perCPUTimes()
6464
}

disk/disk_aix.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"github.com/shirou/gopsutil/v4/internal/common"
1212
)
1313

14-
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
14+
func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
1515
return nil, common.ErrNotImplementedError
1616
}
1717

18-
func LabelWithContext(ctx context.Context, name string) (string, error) {
18+
func LabelWithContext(_ context.Context, _ string) (string, error) {
1919
return "", common.ErrNotImplementedError
2020
}
2121

disk/disk_aix_nocgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var (
2525
}
2626
)
2727

28-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
28+
func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat, error) {
2929
var ret []PartitionStat
3030

3131
out, err := invoke.CommandWithContext(ctx, "mount")

disk/disk_darwin.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// PartitionsWithContext returns disk partition.
1818
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
19-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
19+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
2020
var ret []PartitionStat
2121

2222
count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
@@ -88,15 +88,15 @@ func getFsType(stat unix.Statfs_t) string {
8888
return common.ByteToString(stat.Fstypename[:])
8989
}
9090

91-
func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
91+
func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
9292
return "", common.ErrNotImplementedError
9393
}
9494

95-
func LabelWithContext(ctx context.Context, name string) (string, error) {
95+
func LabelWithContext(_ context.Context, _ string) (string, error) {
9696
return "", common.ErrNotImplementedError
9797
}
9898

99-
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
99+
func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
100100
ioKit, err := common.NewLibrary(common.IOKit)
101101
if err != nil {
102102
return nil, err

disk/disk_fallback.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ import (
99
"github.com/shirou/gopsutil/v4/internal/common"
1010
)
1111

12-
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
12+
func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
1313
return nil, common.ErrNotImplementedError
1414
}
1515

16-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
16+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
1717
return []PartitionStat{}, common.ErrNotImplementedError
1818
}
1919

20-
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
20+
func UsageWithContext(_ context.Context, _ string) (*UsageStat, error) {
2121
return nil, common.ErrNotImplementedError
2222
}
2323

24-
func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
24+
func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
2525
return "", common.ErrNotImplementedError
2626
}
2727

28-
func LabelWithContext(ctx context.Context, name string) (string, error) {
28+
func LabelWithContext(_ context.Context, _ string) (string, error) {
2929
return "", common.ErrNotImplementedError
3030
}

disk/disk_freebsd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
// PartitionsWithContext returns disk partition.
2121
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
22-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
22+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
2323
var ret []PartitionStat
2424

2525
// get length
@@ -188,6 +188,6 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
188188
return serial, nil
189189
}
190190

191-
func LabelWithContext(ctx context.Context, name string) (string, error) {
191+
func LabelWithContext(_ context.Context, _ string) (string, error) {
192192
return "", common.ErrNotImplementedError
193193
}

disk/disk_netbsd.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
MNT_SOFTDEP = 0x80000000 /* Use soft dependencies */
2525
)
2626

27-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
27+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
2828
var ret []PartitionStat
2929

3030
flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h
@@ -97,12 +97,12 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
9797
return ret, nil
9898
}
9999

100-
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
100+
func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) {
101101
ret := make(map[string]IOCountersStat)
102102
return ret, common.ErrNotImplementedError
103103
}
104104

105-
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
105+
func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
106106
stat := Statvfs{}
107107
flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h
108108

@@ -144,10 +144,10 @@ func getFsType(stat Statvfs) string {
144144
return common.ByteToString(stat.Fstypename[:])
145145
}
146146

147-
func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
147+
func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
148148
return "", common.ErrNotImplementedError
149149
}
150150

151-
func LabelWithContext(ctx context.Context, name string) (string, error) {
151+
func LabelWithContext(_ context.Context, _ string) (string, error) {
152152
return "", common.ErrNotImplementedError
153153
}

disk/disk_openbsd.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/shirou/gopsutil/v4/internal/common"
1414
)
1515

16-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
16+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
1717
var ret []PartitionStat
1818

1919
// get length
@@ -70,7 +70,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
7070
return ret, nil
7171
}
7272

73-
func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
73+
func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) {
7474
ret := make(map[string]IOCountersStat)
7575

7676
r, err := unix.SysctlRaw("hw.diskstats")
@@ -122,7 +122,7 @@ func parseDiskstats(buf []byte) (Diskstats, error) {
122122
return ds, nil
123123
}
124124

125-
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
125+
func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
126126
stat := unix.Statfs_t{}
127127
err := unix.Statfs(path, &stat)
128128
if err != nil {
@@ -151,10 +151,10 @@ func getFsType(stat unix.Statfs_t) string {
151151
return common.ByteToString(stat.F_fstypename[:])
152152
}
153153

154-
func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
154+
func SerialNumberWithContext(_ context.Context, _ string) (string, error) {
155155
return "", common.ErrNotImplementedError
156156
}
157157

158-
func LabelWithContext(ctx context.Context, name string) (string, error) {
158+
func LabelWithContext(_ context.Context, _ string) (string, error) {
159159
return "", common.ErrNotImplementedError
160160
}

disk/disk_solaris.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var fsTypeBlacklist = map[string]struct{}{
4444
"proc": {},
4545
}
4646

47-
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
47+
func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) {
4848
ret := make([]PartitionStat, 0, _DEFAULT_NUM_MOUNTS)
4949

5050
// Scan mnttab(4)
@@ -199,7 +199,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
199199
return ret, nil
200200
}
201201

202-
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
202+
func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
203203
statvfs := unix.Statvfs_t{}
204204
if err := unix.Statvfs(path, &statvfs); err != nil {
205205
return nil, fmt.Errorf("unable to call statvfs(2) on %q: %w", path, err)
@@ -258,6 +258,6 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) {
258258
return "", nil
259259
}
260260

261-
func LabelWithContext(ctx context.Context, name string) (string, error) {
261+
func LabelWithContext(_ context.Context, _ string) (string, error) {
262262
return "", common.ErrNotImplementedError
263263
}

disk/disk_unix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"golang.org/x/sys/unix"
1111
)
1212

13-
func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
13+
func UsageWithContext(_ context.Context, path string) (*UsageStat, error) {
1414
stat := unix.Statfs_t{}
1515
err := unix.Statfs(path, &stat)
1616
if err != nil {

0 commit comments

Comments
 (0)