From ccce57b6f534b83b982d9bf98a8dc4da55e5de4f Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 30 Jan 2025 07:43:24 +0100 Subject: [PATCH] chore: enable unused-parameter from revive Signed-off-by: Matthieu MOREL --- .golangci.yml | 3 ++- disk/disk_unix.go | 2 +- docker/docker_linux_test.go | 4 ++-- docker/main_test.go | 2 +- host/host_linux.go | 4 ++-- internal/common/common.go | 2 +- net/net.go | 2 +- net/net_linux.go | 2 +- process/process_linux.go | 4 ++-- process/process_posix.go | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c3330cd8f..008bb91e8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -94,7 +94,6 @@ linters-settings: disabled: true - name: unreachable-code - name: unused-parameter - disabled: true - name: use-any disabled: true - name: var-declaration @@ -102,3 +101,5 @@ linters-settings: disabled: true testifylint: enable-all: true +run: + timeout: 2m diff --git a/disk/disk_unix.go b/disk/disk_unix.go index d69d83817..482372da2 100644 --- a/disk/disk_unix.go +++ b/disk/disk_unix.go @@ -10,7 +10,7 @@ import ( "golang.org/x/sys/unix" ) -func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { +func UsageWithContext(_ context.Context, path string) (*UsageStat, error) { stat := unix.Statfs_t{} err := unix.Statfs(path, &stat) if err != nil { diff --git a/docker/docker_linux_test.go b/docker/docker_linux_test.go index 2d0f35b03..f1cf3e0ca 100644 --- a/docker/docker_linux_test.go +++ b/docker/docker_linux_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestGetDockerIDList(t *testing.T) { +func TestGetDockerIDList(_ *testing.T) { // If there is not docker environment, this test always fail. // not tested here /* @@ -19,7 +19,7 @@ func TestGetDockerIDList(t *testing.T) { */ } -func TestGetDockerStat(t *testing.T) { +func TestGetDockerStat(_ *testing.T) { // If there is not docker environment, this test always fail. // not tested here diff --git a/docker/main_test.go b/docker/main_test.go index 14ee18689..98fac9461 100644 --- a/docker/main_test.go +++ b/docker/main_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestSysAdvancedDockerInfo(t *testing.T) { +func TestSysAdvancedDockerInfo(_ *testing.T) { list, err := GetDockerIDList() if err != nil { fmt.Println(err) diff --git a/host/host_linux.go b/host/host_linux.go index dd03f1555..f2cb0e570 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -70,7 +70,7 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) { return common.BootTimeWithContext(ctx, enableBootTimeCache) } -func UptimeWithContext(ctx context.Context) (uint64, error) { +func UptimeWithContext(_ context.Context) (uint64, error) { sysinfo := &unix.Sysinfo_t{} if err := unix.Sysinfo(sysinfo); err != nil { return 0, err @@ -322,7 +322,7 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil return platform, family, version, nil } -func KernelVersionWithContext(ctx context.Context) (version string, err error) { +func KernelVersionWithContext(_ context.Context) (version string, err error) { var utsname unix.Utsname err = unix.Uname(&utsname) if err != nil { diff --git a/internal/common/common.go b/internal/common/common.go index 868ea4dae..18dc8dc6e 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -93,7 +93,7 @@ func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) { return []byte{}, fmt.Errorf("could not find testdata: %s", fpath) } -func (i FakeInvoke) CommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error) { +func (i FakeInvoke) CommandWithContext(_ context.Context, name string, arg ...string) ([]byte, error) { return i.Command(name, arg...) } diff --git a/net/net.go b/net/net.go index 74af54a45..b4fff6e7a 100644 --- a/net/net.go +++ b/net/net.go @@ -207,7 +207,7 @@ func Interfaces() (InterfaceStatList, error) { return InterfacesWithContext(context.Background()) } -func InterfacesWithContext(ctx context.Context) (InterfaceStatList, error) { +func InterfacesWithContext(_ context.Context) (InterfaceStatList, error) { is, err := net.Interfaces() if err != nil { return nil, err diff --git a/net/net_linux.go b/net/net_linux.go index 23113fea7..967ef4b7c 100644 --- a/net/net_linux.go +++ b/net/net_linux.go @@ -44,7 +44,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return IOCountersByFileWithContext(ctx, pernic, filename) } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(_ context.Context, pernic bool, filename string) ([]IOCountersStat, error) { lines, err := common.ReadLines(filename) if err != nil { return nil, err diff --git a/process/process_linux.go b/process/process_linux.go index 68a8c88c4..bf96fd386 100644 --- a/process/process_linux.go +++ b/process/process_linux.go @@ -194,7 +194,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { return nice, nil } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } @@ -310,7 +310,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) return cpuTimes, nil } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_posix.go b/process/process_posix.go index 96c5e065c..6712f95d0 100644 --- a/process/process_posix.go +++ b/process/process_posix.go @@ -140,7 +140,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { return false, err } -func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { +func (p *Process) SendSignalWithContext(_ context.Context, sig syscall.Signal) error { process, err := os.FindProcess(int(p.Pid)) if err != nil { return err