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
4 changes: 2 additions & 2 deletions btf/ext_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ func parseCORERelos(r io.Reader, bo binary.ByteOrder, strings *stringTable) (map
return nil, err
}

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

var relo bpfCORERelo
Expand Down
2 changes: 1 addition & 1 deletion btf/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestRoundtripVMlinux(t *testing.T) {
visited := make(map[Type]struct{})
limitTypes:
for i, typ := range types {
visitInPostorder(typ, visited, func(t Type) bool { return true })
visitInPostorder(typ, visited, func(_ Type) bool { return true })
if len(visited) >= math.MaxInt16 {
// IDs exceeding math.MaxUint16 can trigger a bug when loading BTF.
// This can be removed once the patch lands.
Expand Down
2 changes: 1 addition & 1 deletion link/kprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func kprobe(symbol string, prog *ebpf.Program, opts *KprobeOptions, ret bool) (*
if err == nil {
return tp, nil
}
if err != nil && !errors.Is(err, ErrNotSupported) {
if !errors.Is(err, ErrNotSupported) {
return nil, fmt.Errorf("creating perf_kprobe PMU (arch-specific fallback for %q): %w", symbol, err)
}

Expand Down
2 changes: 1 addition & 1 deletion link/kprobe_multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type kprobeMultiLink struct {

var _ Link = (*kprobeMultiLink)(nil)

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

Expand Down
2 changes: 1 addition & 1 deletion link/netfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func AttachNetfilter(opts NetfilterOptions) (Link, error) {
return &netfilterLink{RawLink{fd, ""}}, nil
}

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

Expand Down
4 changes: 2 additions & 2 deletions link/perf_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (pl *perfEventLink) Close() error {
return nil
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion link/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type tracing struct {
RawLink
}

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

Expand Down
2 changes: 1 addition & 1 deletion link/uprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (ex *Executable) uprobe(symbol string, prog *ebpf.Program, opts *UprobeOpti
if err == nil {
return tp, nil
}
if err != nil && !errors.Is(err, ErrNotSupported) {
if !errors.Is(err, ErrNotSupported) {
return nil, fmt.Errorf("creating perf_uprobe PMU: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion link/uprobe_multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ type uprobeMultiLink struct {

var _ Link = (*uprobeMultiLink)(nil)

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

Expand Down
6 changes: 3 additions & 3 deletions map.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func newMapWithOptions(spec *MapSpec, opts MapOptions) (_ *Map, err error) {
return nil, errors.New("inner maps cannot be pinned")
}

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

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

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