Skip to content

Commit 625b0a9

Browse files
committed
*: remove unused parameters and tautological conditions
These get flagged by gopls and always stick around in my editor, so I decided to get rid of them. There's currently no way to run the gopls linters in CI, so not modifying the linter config at this time. Signed-off-by: Timo Beckers <[email protected]>
1 parent 642d9ae commit 625b0a9

File tree

10 files changed

+14
-14
lines changed

10 files changed

+14
-14
lines changed

btf/ext_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ func parseCORERelos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map
799799
return nil, err
800800
}
801801

802-
records, err := parseCOREReloRecords(r, bo, recordSize, infoHeader.NumInfo)
802+
records, err := parseCOREReloRecords(r, bo, infoHeader.NumInfo)
803803
if err != nil {
804804
return nil, fmt.Errorf("section %v: %w", secName, err)
805805
}
@@ -811,7 +811,7 @@ func parseCORERelos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map
811811
// parseCOREReloRecords parses a stream of CO-RE relocation entries into a
812812
// coreRelos. These records appear after a btf_ext_info_sec header in the
813813
// core_relos sub-section of .BTF.ext.
814-
func parseCOREReloRecords(r io.Reader, bo binary.ByteOrder, recordSize uint32, recordNum uint32) ([]bpfCORERelo, error) {
814+
func parseCOREReloRecords(r io.Reader, bo binary.ByteOrder, recordNum uint32) ([]bpfCORERelo, error) {
815815
var out []bpfCORERelo
816816

817817
var relo bpfCORERelo

btf/marshal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestRoundtripVMlinux(t *testing.T) {
8282
visited := make(map[Type]struct{})
8383
limitTypes:
8484
for i, typ := range types {
85-
visitInPostorder(typ, visited, func(t Type) bool { return true })
85+
visitInPostorder(typ, visited, func(_ Type) bool { return true })
8686
if len(visited) >= math.MaxInt16 {
8787
// IDs exceeding math.MaxUint16 can trigger a bug when loading BTF.
8888
// This can be removed once the patch lands.

link/kprobe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func kprobe(symbol string, prog *ebpf.Program, opts *KprobeOptions, ret bool) (*
177177
if err == nil {
178178
return tp, nil
179179
}
180-
if err != nil && !errors.Is(err, ErrNotSupported) {
180+
if !errors.Is(err, ErrNotSupported) {
181181
return nil, fmt.Errorf("creating perf_kprobe PMU (arch-specific fallback for %q): %w", symbol, err)
182182
}
183183

link/kprobe_multi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ type kprobeMultiLink struct {
126126

127127
var _ Link = (*kprobeMultiLink)(nil)
128128

129-
func (kml *kprobeMultiLink) Update(prog *ebpf.Program) error {
129+
func (kml *kprobeMultiLink) Update(_ *ebpf.Program) error {
130130
return fmt.Errorf("update kprobe_multi: %w", ErrNotSupported)
131131
}
132132

link/netfilter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func AttachNetfilter(opts NetfilterOptions) (Link, error) {
6363
return &netfilterLink{RawLink{fd, ""}}, nil
6464
}
6565

66-
func (*netfilterLink) Update(new *ebpf.Program) error {
66+
func (*netfilterLink) Update(_ *ebpf.Program) error {
6767
return fmt.Errorf("netfilter update: %w", ErrNotSupported)
6868
}
6969

link/perf_event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (pl *perfEventLink) Close() error {
115115
return nil
116116
}
117117

118-
func (pl *perfEventLink) Update(prog *ebpf.Program) error {
118+
func (pl *perfEventLink) Update(_ *ebpf.Program) error {
119119
return fmt.Errorf("perf event link update: %w", ErrNotSupported)
120120
}
121121

@@ -185,7 +185,7 @@ func (pi *perfEventIoctl) isLink() {}
185185
//
186186
// Detaching a program from a perf event is currently not possible, so a
187187
// program replacement mechanism cannot be implemented for perf events.
188-
func (pi *perfEventIoctl) Update(prog *ebpf.Program) error {
188+
func (pi *perfEventIoctl) Update(_ *ebpf.Program) error {
189189
return fmt.Errorf("perf event ioctl update: %w", ErrNotSupported)
190190
}
191191

link/tracing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type tracing struct {
1414
RawLink
1515
}
1616

17-
func (f *tracing) Update(new *ebpf.Program) error {
17+
func (f *tracing) Update(_ *ebpf.Program) error {
1818
return fmt.Errorf("tracing update: %w", ErrNotSupported)
1919
}
2020

link/uprobe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (ex *Executable) uprobe(symbol string, prog *ebpf.Program, opts *UprobeOpti
321321
if err == nil {
322322
return tp, nil
323323
}
324-
if err != nil && !errors.Is(err, ErrNotSupported) {
324+
if !errors.Is(err, ErrNotSupported) {
325325
return nil, fmt.Errorf("creating perf_uprobe PMU: %w", err)
326326
}
327327

link/uprobe_multi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ type uprobeMultiLink struct {
168168

169169
var _ Link = (*uprobeMultiLink)(nil)
170170

171-
func (kml *uprobeMultiLink) Update(prog *ebpf.Program) error {
171+
func (kml *uprobeMultiLink) Update(_ *ebpf.Program) error {
172172
return fmt.Errorf("update uprobe_multi: %w", ErrNotSupported)
173173
}
174174

map.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func newMapWithOptions(spec *MapSpec, opts MapOptions) (_ *Map, err error) {
359359
return nil, errors.New("inner maps cannot be pinned")
360360
}
361361

362-
template, err := spec.InnerMap.createMap(nil, opts)
362+
template, err := spec.InnerMap.createMap(nil)
363363
if err != nil {
364364
return nil, fmt.Errorf("inner map: %w", err)
365365
}
@@ -371,7 +371,7 @@ func newMapWithOptions(spec *MapSpec, opts MapOptions) (_ *Map, err error) {
371371
innerFd = template.fd
372372
}
373373

374-
m, err := spec.createMap(innerFd, opts)
374+
m, err := spec.createMap(innerFd)
375375
if err != nil {
376376
return nil, err
377377
}
@@ -389,7 +389,7 @@ func newMapWithOptions(spec *MapSpec, opts MapOptions) (_ *Map, err error) {
389389

390390
// createMap validates the spec's properties and creates the map in the kernel
391391
// using the given opts. It does not populate or freeze the map.
392-
func (spec *MapSpec) createMap(inner *sys.FD, opts MapOptions) (_ *Map, err error) {
392+
func (spec *MapSpec) createMap(inner *sys.FD) (_ *Map, err error) {
393393
closeOnError := func(closer io.Closer) {
394394
if err != nil {
395395
closer.Close()

0 commit comments

Comments
 (0)