diff --git a/.golangci.yml b/.golangci.yml index 9229c0905..4da0d0e6d 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 - name: var-declaration - name: var-naming diff --git a/cpu/cpu_darwin.go b/cpu/cpu_darwin.go index b3e3a668d..91bac66f9 100644 --- a/cpu/cpu_darwin.go +++ b/cpu/cpu_darwin.go @@ -59,7 +59,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { lib, err := common.NewLibrary(common.System) if err != nil { return nil, err @@ -78,7 +78,7 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { var ret []InfoStat c := InfoStat{} @@ -121,7 +121,7 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) { return append(ret, c), nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, logical bool) (int, error) { var cpuArgument string if logical { cpuArgument = "hw.logicalcpu" diff --git a/cpu/cpu_dragonfly.go b/cpu/cpu_dragonfly.go index fb9b93736..8232c483c 100644 --- a/cpu/cpu_dragonfly.go +++ b/cpu/cpu_dragonfly.go @@ -51,7 +51,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { if percpu { buf, err := unix.SysctlRaw("kern.cp_times") if err != nil { @@ -92,7 +92,7 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { const dmesgBoot = "/var/run/dmesg.boot" c, err := parseDmesgBoot(dmesgBoot) @@ -153,6 +153,6 @@ func parseDmesgBoot(fileName string) (InfoStat, error) { return c, nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_freebsd.go b/cpu/cpu_freebsd.go index 5d17c7e97..107b574f8 100644 --- a/cpu/cpu_freebsd.go +++ b/cpu/cpu_freebsd.go @@ -52,7 +52,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { if percpu { buf, err := unix.SysctlRaw("kern.cp_times") if err != nil { @@ -93,7 +93,7 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { const dmesgBoot = "/var/run/dmesg.boot" c, num, err := parseDmesgBoot(dmesgBoot) @@ -165,6 +165,6 @@ func parseDmesgBoot(fileName string) (InfoStat, int, error) { return c, cpuNum, nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_netbsd.go b/cpu/cpu_netbsd.go index 7d807dc43..cc7698598 100644 --- a/cpu/cpu_netbsd.go +++ b/cpu/cpu_netbsd.go @@ -36,7 +36,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { +func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) { if !percpu { mib := []int32{ctlKern, kernCpTime} buf, _, err := common.CallSyscall(mib) @@ -87,7 +87,7 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { var ret []InfoStat var err error @@ -115,6 +115,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) { return append(ret, c), nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_openbsd.go b/cpu/cpu_openbsd.go index 30d87ac68..9038a4d33 100644 --- a/cpu/cpu_openbsd.go +++ b/cpu/cpu_openbsd.go @@ -54,7 +54,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) (ret []TimesStat, err error) { +func TimesWithContext(_ context.Context, percpu bool) (ret []TimesStat, err error) { if !percpu { mib := []int32{ctlKern, kernCpTime} buf, _, err := common.CallSyscall(mib) @@ -108,7 +108,7 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { var ret []InfoStat var err error @@ -133,6 +133,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) { return append(ret, c), nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_plan9.go b/cpu/cpu_plan9.go index d6f63ba1e..02ad3f747 100644 --- a/cpu/cpu_plan9.go +++ b/cpu/cpu_plan9.go @@ -17,7 +17,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { +func TimesWithContext(ctx context.Context, _ bool) ([]TimesStat, error) { // BUG: percpu flag is not supported yet. root := os.Getenv("HOST_ROOT") c, err := stats.ReadCPUType(ctx, stats.WithRootDir(root)) @@ -42,10 +42,10 @@ func Info() ([]InfoStat, error) { return InfoWithContext(context.Background()) } -func InfoWithContext(ctx context.Context) ([]InfoStat, error) { +func InfoWithContext(_ context.Context) ([]InfoStat, error) { return []InfoStat{}, common.ErrNotImplementedError } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_solaris.go b/cpu/cpu_solaris.go index 91d41a9f8..7bfdf2ced 100644 --- a/cpu/cpu_solaris.go +++ b/cpu/cpu_solaris.go @@ -265,6 +265,6 @@ func parseProcessorInfo(cmdOutput string) ([]InfoStat, error) { return result, nil } -func CountsWithContext(ctx context.Context, logical bool) (int, error) { +func CountsWithContext(_ context.Context, _ bool) (int, error) { return runtime.NumCPU(), nil } diff --git a/cpu/cpu_windows.go b/cpu/cpu_windows.go index a71df97fe..c839ea461 100644 --- a/cpu/cpu_windows.go +++ b/cpu/cpu_windows.go @@ -58,7 +58,7 @@ func Times(percpu bool) ([]TimesStat, error) { return TimesWithContext(context.Background(), percpu) } -func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) { +func TimesWithContext(_ context.Context, percpu bool) ([]TimesStat, error) { if percpu { return perCPUTimes() } diff --git a/disk/disk_darwin.go b/disk/disk_darwin.go index 94f10b9fb..39fccff6b 100644 --- a/disk/disk_darwin.go +++ b/disk/disk_darwin.go @@ -16,7 +16,7 @@ import ( // PartitionsWithContext returns disk partition. // 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { var ret []PartitionStat count, err := unix.Getfsstat(nil, unix.MNT_WAIT) @@ -88,15 +88,15 @@ func getFsType(stat unix.Statfs_t) string { return common.ByteToString(stat.Fstypename[:]) } -func SerialNumberWithContext(ctx context.Context, name string) (string, error) { +func SerialNumberWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) { ioKit, err := common.NewLibrary(common.IOKit) if err != nil { return nil, err diff --git a/disk/disk_fallback.go b/disk/disk_fallback.go index 17f0f7bf4..3b58cebc1 100644 --- a/disk/disk_fallback.go +++ b/disk/disk_fallback.go @@ -9,22 +9,22 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) { return nil, common.ErrNotImplementedError } -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { return []PartitionStat{}, common.ErrNotImplementedError } -func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { +func UsageWithContext(_ context.Context, _ string) (*UsageStat, error) { return nil, common.ErrNotImplementedError } -func SerialNumberWithContext(ctx context.Context, name string) (string, error) { +func SerialNumberWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } diff --git a/disk/disk_freebsd.go b/disk/disk_freebsd.go index 9715d7622..b18c1b510 100644 --- a/disk/disk_freebsd.go +++ b/disk/disk_freebsd.go @@ -19,7 +19,7 @@ import ( // PartitionsWithContext returns disk partition. // 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { var ret []PartitionStat // get length @@ -188,6 +188,6 @@ func SerialNumberWithContext(ctx context.Context, name string) (string, error) { return serial, nil } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } diff --git a/disk/disk_netbsd.go b/disk/disk_netbsd.go index ea7e4e2db..9d9e56ff3 100644 --- a/disk/disk_netbsd.go +++ b/disk/disk_netbsd.go @@ -24,7 +24,7 @@ const ( MNT_SOFTDEP = 0x80000000 /* Use soft dependencies */ ) -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { var ret []PartitionStat flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h @@ -97,12 +97,12 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro return ret, nil } -func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, _ ...string) (map[string]IOCountersStat, error) { ret := make(map[string]IOCountersStat) return ret, common.ErrNotImplementedError } -func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { +func UsageWithContext(_ context.Context, path string) (*UsageStat, error) { stat := Statvfs{} flag := uint64(1) // ST_WAIT/MNT_WAIT, see sys/fstypes.h @@ -144,10 +144,10 @@ func getFsType(stat Statvfs) string { return common.ByteToString(stat.Fstypename[:]) } -func SerialNumberWithContext(ctx context.Context, name string) (string, error) { +func SerialNumberWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } diff --git a/disk/disk_openbsd.go b/disk/disk_openbsd.go index c840088df..2b0ce1086 100644 --- a/disk/disk_openbsd.go +++ b/disk/disk_openbsd.go @@ -13,7 +13,7 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { var ret []PartitionStat // get length @@ -70,7 +70,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro return ret, nil } -func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) { ret := make(map[string]IOCountersStat) r, err := unix.SysctlRaw("hw.diskstats") @@ -122,7 +122,7 @@ func parseDiskstats(buf []byte) (Diskstats, error) { return ds, nil } -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 { @@ -151,10 +151,10 @@ func getFsType(stat unix.Statfs_t) string { return common.ByteToString(stat.F_fstypename[:]) } -func SerialNumberWithContext(ctx context.Context, name string) (string, error) { +func SerialNumberWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } diff --git a/disk/disk_solaris.go b/disk/disk_solaris.go index 7360a47a2..16239efc5 100644 --- a/disk/disk_solaris.go +++ b/disk/disk_solaris.go @@ -44,7 +44,7 @@ var fsTypeBlacklist = map[string]struct{}{ "proc": {}, } -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(_ context.Context, _ bool) ([]PartitionStat, error) { ret := make([]PartitionStat, 0, _DEFAULT_NUM_MOUNTS) // Scan mnttab(4) @@ -199,7 +199,7 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC return ret, nil } -func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { +func UsageWithContext(_ context.Context, path string) (*UsageStat, error) { statvfs := unix.Statvfs_t{} if err := unix.Statvfs(path, &statvfs); err != nil { 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) { return "", nil } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } 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/disk/disk_windows.go b/disk/disk_windows.go index 5f2438941..b9343cb2b 100644 --- a/disk/disk_windows.go +++ b/disk/disk_windows.go @@ -55,7 +55,7 @@ func init() { } } -func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { +func UsageWithContext(_ context.Context, path string) (*UsageStat, error) { lpFreeBytesAvailable := int64(0) lpTotalNumberOfBytes := int64(0) lpTotalNumberOfFreeBytes := int64(0) @@ -83,7 +83,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) { // PartitionsWithContext returns disk partitions. // Since GetVolumeInformation doesn't have a timeout, this method uses context to set deadline by users. -func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { +func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat, error) { warnings := Warnings{ Verbose: true, } @@ -182,7 +182,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro } } -func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, names ...string) (map[string]IOCountersStat, error) { // https://github.com/giampaolo/psutil/blob/544e9daa4f66a9f80d7bf6c7886d693ee42f0a13/psutil/arch/windows/disk.c#L83 drivemap := make(map[string]IOCountersStat, 0) var diskPerformance diskPerformance @@ -236,10 +236,10 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC return drivemap, nil } -func SerialNumberWithContext(ctx context.Context, name string) (string, error) { +func SerialNumberWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } -func LabelWithContext(ctx context.Context, name string) (string, error) { +func LabelWithContext(_ context.Context, _ string) (string, error) { return "", common.ErrNotImplementedError } 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/docker_notlinux.go b/docker/docker_notlinux.go index ca7a7f914..9627e0439 100644 --- a/docker/docker_notlinux.go +++ b/docker/docker_notlinux.go @@ -15,7 +15,7 @@ func GetDockerStat() ([]CgroupDockerStat, error) { return GetDockerStatWithContext(context.Background()) } -func GetDockerStatWithContext(ctx context.Context) ([]CgroupDockerStat, error) { +func GetDockerStatWithContext(_ context.Context) ([]CgroupDockerStat, error) { return nil, ErrDockerNotAvailable } @@ -25,7 +25,7 @@ func GetDockerIDList() ([]string, error) { return GetDockerIDListWithContext(context.Background()) } -func GetDockerIDListWithContext(ctx context.Context) ([]string, error) { +func GetDockerIDListWithContext(_ context.Context) ([]string, error) { return nil, ErrDockerNotAvailable } @@ -37,7 +37,7 @@ func CgroupCPU(containerid string, base string) (*CgroupCPUStat, error) { return CgroupCPUWithContext(context.Background(), containerid, base) } -func CgroupCPUWithContext(ctx context.Context, containerid string, base string) (*CgroupCPUStat, error) { +func CgroupCPUWithContext(_ context.Context, _ string, _ string) (*CgroupCPUStat, error) { return nil, ErrCgroupNotAvailable } @@ -53,7 +53,7 @@ func CgroupMem(containerid string, base string) (*CgroupMemStat, error) { return CgroupMemWithContext(context.Background(), containerid, base) } -func CgroupMemWithContext(ctx context.Context, containerid string, base string) (*CgroupMemStat, error) { +func CgroupMemWithContext(_ context.Context, _ string, _ string) (*CgroupMemStat, error) { return nil, ErrCgroupNotAvailable } 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_bsd.go b/host/host_bsd.go index b67f8fb6e..4d27ed621 100644 --- a/host/host_bsd.go +++ b/host/host_bsd.go @@ -13,7 +13,7 @@ import ( // cachedBootTime must be accessed via atomic.Load/StoreUint64 var cachedBootTime uint64 -func BootTimeWithContext(ctx context.Context) (uint64, error) { +func BootTimeWithContext(_ context.Context) (uint64, error) { if enableBootTimeCache { t := atomic.LoadUint64(&cachedBootTime) if t != 0 { diff --git a/host/host_darwin.go b/host/host_darwin.go index 068f1060a..977426d43 100644 --- a/host/host_darwin.go +++ b/host/host_darwin.go @@ -49,7 +49,7 @@ func numProcs(ctx context.Context) (uint64, error) { return uint64(len(procs)), nil } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { utmpfile := "/var/run/utmpx" var ret []UserStat @@ -123,11 +123,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string return platform, family, pver, nil } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } -func KernelVersionWithContext(ctx context.Context) (string, error) { +func KernelVersionWithContext(_ context.Context) (string, error) { version, err := unix.Sysctl("kern.osrelease") return strings.ToLower(version), err } diff --git a/host/host_fallback.go b/host/host_fallback.go index bc8397909..ed2a4ceb5 100644 --- a/host/host_fallback.go +++ b/host/host_fallback.go @@ -9,35 +9,35 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func HostIDWithContext(ctx context.Context) (string, error) { +func HostIDWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func numProcs(ctx context.Context) (uint64, error) { +func numProcs(_ context.Context) (uint64, error) { return 0, common.ErrNotImplementedError } -func BootTimeWithContext(ctx context.Context) (uint64, error) { +func BootTimeWithContext(_ context.Context) (uint64, error) { return 0, common.ErrNotImplementedError } -func UptimeWithContext(ctx context.Context) (uint64, error) { +func UptimeWithContext(_ context.Context) (uint64, error) { return 0, common.ErrNotImplementedError } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { return []UserStat{}, common.ErrNotImplementedError } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } -func KernelVersionWithContext(ctx context.Context) (string, error) { +func KernelVersionWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { +func PlatformInformationWithContext(_ context.Context) (string, string, string, error) { return "", "", "", common.ErrNotImplementedError } diff --git a/host/host_freebsd.go b/host/host_freebsd.go index 52364f173..59bf49c23 100644 --- a/host/host_freebsd.go +++ b/host/host_freebsd.go @@ -25,7 +25,7 @@ const ( UTHostSize = 16 ) -func HostIDWithContext(ctx context.Context) (string, error) { +func HostIDWithContext(_ context.Context) (string, error) { uuid, err := unix.Sysctl("kern.hostuuid") if err != nil { return "", err @@ -41,7 +41,7 @@ func numProcs(ctx context.Context) (uint64, error) { return uint64(len(procs)), nil } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { utmpfile := "/var/run/utx.active" if !common.PathExists(utmpfile) { utmpfile = "/var/run/utmp" // before 9.0 @@ -85,7 +85,7 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) { return ret, nil } -func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { +func PlatformInformationWithContext(_ context.Context) (string, string, string, error) { platform, err := unix.Sysctl("kern.ostype") if err != nil { return "", "", "", err @@ -99,7 +99,7 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string return strings.ToLower(platform), "", strings.ToLower(version), nil } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } 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/host/host_netbsd.go b/host/host_netbsd.go index a6680a602..942f6871f 100644 --- a/host/host_netbsd.go +++ b/host/host_netbsd.go @@ -12,15 +12,15 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func HostIDWithContext(ctx context.Context) (string, error) { +func HostIDWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func numProcs(ctx context.Context) (uint64, error) { +func numProcs(_ context.Context) (uint64, error) { return 0, common.ErrNotImplementedError } -func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { +func PlatformInformationWithContext(_ context.Context) (string, string, string, error) { platform := "" family := "" version := "" @@ -37,11 +37,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string return platform, family, version, nil } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { var ret []UserStat return ret, common.ErrNotImplementedError } diff --git a/host/host_openbsd.go b/host/host_openbsd.go index d5a5cd10d..cc6e8fd82 100644 --- a/host/host_openbsd.go +++ b/host/host_openbsd.go @@ -24,7 +24,7 @@ const ( UTHostSize = 16 ) -func HostIDWithContext(ctx context.Context) (string, error) { +func HostIDWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } @@ -36,7 +36,7 @@ func numProcs(ctx context.Context) (uint64, error) { return uint64(len(procs)), nil } -func PlatformInformationWithContext(ctx context.Context) (string, string, string, error) { +func PlatformInformationWithContext(_ context.Context) (string, string, string, error) { platform := "" family := "" version := "" @@ -53,11 +53,11 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string return platform, family, version, nil } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { var ret []UserStat utmpfile := "/var/run/utmp" file, err := os.Open(utmpfile) diff --git a/host/host_solaris.go b/host/host_solaris.go index e7adba017..0e1246d70 100644 --- a/host/host_solaris.go +++ b/host/host_solaris.go @@ -59,7 +59,7 @@ func HostIDWithContext(ctx context.Context) (string, error) { } // Count number of processes based on the number of entries in /proc -func numProcs(ctx context.Context) (uint64, error) { +func numProcs(_ context.Context) (uint64, error) { dirs, err := os.ReadDir("/proc") if err != nil { return 0, err @@ -83,7 +83,7 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) { return strconv.ParseUint(kstats[0][2], 10, 64) } -func UptimeWithContext(ctx context.Context) (uint64, error) { +func UptimeWithContext(_ context.Context) (uint64, error) { bootTime, err := BootTime() //nolint:contextcheck //FIXME if err != nil { return 0, err @@ -91,11 +91,11 @@ func UptimeWithContext(ctx context.Context) (uint64, error) { return timeSince(bootTime), nil } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { return []UserStat{}, common.ErrNotImplementedError } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } diff --git a/host/host_windows.go b/host/host_windows.go index 41f4b7f02..3e8d0b1cd 100644 --- a/host/host_windows.go +++ b/host/host_windows.go @@ -56,7 +56,7 @@ type systemInfo struct { wProcessorRevision uint16 } -func HostIDWithContext(ctx context.Context) (string, error) { +func HostIDWithContext(_ context.Context) (string, error) { // there has been reports of issues on 32bit using golang.org/x/sys/windows/registry, see https://github.com/shirou/gopsutil/pull/312#issuecomment-277422612 // for rationale of using windows.RegOpenKeyEx/RegQueryValueEx instead of registry.OpenKey/GetStringValue var h windows.Handle @@ -94,7 +94,7 @@ func numProcs(ctx context.Context) (uint64, error) { return uint64(len(procs)), nil } -func UptimeWithContext(ctx context.Context) (uint64, error) { +func UptimeWithContext(_ context.Context) (uint64, error) { up, err := uptimeMillis() if err != nil { return 0, err @@ -118,7 +118,7 @@ func uptimeMillis() (uint64, error) { // cachedBootTime must be accessed via atomic.Load/StoreUint64 var cachedBootTime uint64 -func BootTimeWithContext(ctx context.Context) (uint64, error) { +func BootTimeWithContext(_ context.Context) (uint64, error) { if enableBootTimeCache { t := atomic.LoadUint64(&cachedBootTime) if t != 0 { @@ -234,13 +234,13 @@ func platformInformation() (platform, family, version, displayVersion string, er return platform, family, version, displayVersion, nil } -func UsersWithContext(ctx context.Context) ([]UserStat, error) { +func UsersWithContext(_ context.Context) ([]UserStat, error) { var ret []UserStat return ret, common.ErrNotImplementedError } -func VirtualizationWithContext(ctx context.Context) (string, string, error) { +func VirtualizationWithContext(_ context.Context) (string, string, error) { return "", "", common.ErrNotImplementedError } diff --git a/internal/common/common.go b/internal/common/common.go index 39816031c..8b9fb5339 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/load/load_bsd.go b/load/load_bsd.go index 97001f3c6..7ce138e66 100644 --- a/load/load_bsd.go +++ b/load/load_bsd.go @@ -15,7 +15,7 @@ func Avg() (*AvgStat, error) { return AvgWithContext(context.Background()) } -func AvgWithContext(ctx context.Context) (*AvgStat, error) { +func AvgWithContext(_ context.Context) (*AvgStat, error) { // This SysctlRaw method borrowed from // https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go type loadavg struct { diff --git a/load/load_darwin.go b/load/load_darwin.go index fb7d5c09c..e07ec3a5d 100644 --- a/load/load_darwin.go +++ b/load/load_darwin.go @@ -15,7 +15,7 @@ func Avg() (*AvgStat, error) { return AvgWithContext(context.Background()) } -func AvgWithContext(ctx context.Context) (*AvgStat, error) { +func AvgWithContext(_ context.Context) (*AvgStat, error) { // This SysctlRaw method borrowed from // https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_freebsd.go // this implementation is common with BSDs diff --git a/load/load_fallback.go b/load/load_fallback.go index e633066be..b681f0c2d 100644 --- a/load/load_fallback.go +++ b/load/load_fallback.go @@ -13,7 +13,7 @@ func Avg() (*AvgStat, error) { return AvgWithContext(context.Background()) } -func AvgWithContext(ctx context.Context) (*AvgStat, error) { +func AvgWithContext(_ context.Context) (*AvgStat, error) { return nil, common.ErrNotImplementedError } @@ -21,6 +21,6 @@ func Misc() (*MiscStat, error) { return MiscWithContext(context.Background()) } -func MiscWithContext(ctx context.Context) (*MiscStat, error) { +func MiscWithContext(_ context.Context) (*MiscStat, error) { return nil, common.ErrNotImplementedError } diff --git a/load/load_windows.go b/load/load_windows.go index f430d2aa7..c9e8a5250 100644 --- a/load/load_windows.go +++ b/load/load_windows.go @@ -86,7 +86,7 @@ func Misc() (*MiscStat, error) { return MiscWithContext(context.Background()) } -func MiscWithContext(ctx context.Context) (*MiscStat, error) { +func MiscWithContext(_ context.Context) (*MiscStat, error) { ret := MiscStat{} return &ret, common.ErrNotImplementedError diff --git a/mem/mem_darwin.go b/mem/mem_darwin.go index a4c15f691..7d96a3bb0 100644 --- a/mem/mem_darwin.go +++ b/mem/mem_darwin.go @@ -35,7 +35,7 @@ func SwapMemory() (*SwapMemoryStat, error) { return SwapMemoryWithContext(context.Background()) } -func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { // https://github.com/yanllearnn/go-osstat/blob/ae8a279d26f52ec946a03698c7f50a26cfb427e3/memory/memory_darwin.go var ret *SwapMemoryStat @@ -67,7 +67,7 @@ func SwapDevices() ([]*SwapDevice, error) { return SwapDevicesWithContext(context.Background()) } -func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { return nil, common.ErrNotImplementedError } @@ -84,7 +84,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { machLib, err := common.NewLibrary(common.System) if err != nil { return nil, err diff --git a/mem/mem_fallback.go b/mem/mem_fallback.go index ba882c8be..74283a2b5 100644 --- a/mem/mem_fallback.go +++ b/mem/mem_fallback.go @@ -13,7 +13,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { return nil, common.ErrNotImplementedError } @@ -21,7 +21,7 @@ func SwapMemory() (*SwapMemoryStat, error) { return SwapMemoryWithContext(context.Background()) } -func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { return nil, common.ErrNotImplementedError } @@ -29,6 +29,6 @@ func SwapDevices() ([]*SwapDevice, error) { return SwapDevicesWithContext(context.Background()) } -func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { return nil, common.ErrNotImplementedError } diff --git a/mem/mem_freebsd.go b/mem/mem_freebsd.go index a6deddebd..338da7e88 100644 --- a/mem/mem_freebsd.go +++ b/mem/mem_freebsd.go @@ -17,7 +17,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { pageSize, err := common.SysctlUint("vm.stats.vm.v_page_size") if err != nil { return nil, err @@ -110,7 +110,7 @@ type xswdev11 struct { Used int32 // Used is the number of blocks used } -func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { // FreeBSD can have multiple swap devices so we total them up i, err := common.SysctlUint("vm.nswapdev") if err != nil { diff --git a/mem/mem_netbsd.go b/mem/mem_netbsd.go index 0a41b3e34..8ef539ca3 100644 --- a/mem/mem_netbsd.go +++ b/mem/mem_netbsd.go @@ -15,7 +15,7 @@ func GetPageSize() (uint64, error) { return GetPageSizeWithContext(context.Background()) } -func GetPageSizeWithContext(ctx context.Context) (uint64, error) { +func GetPageSizeWithContext(_ context.Context) (uint64, error) { uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") if err != nil { return 0, err @@ -27,7 +27,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { uvmexp, err := unix.SysctlUvmexp("vm.uvmexp2") if err != nil { return nil, err diff --git a/mem/mem_openbsd.go b/mem/mem_openbsd.go index ade3a1270..680cad12b 100644 --- a/mem/mem_openbsd.go +++ b/mem/mem_openbsd.go @@ -19,7 +19,7 @@ func GetPageSize() (uint64, error) { return GetPageSizeWithContext(context.Background()) } -func GetPageSizeWithContext(ctx context.Context) (uint64, error) { +func GetPageSizeWithContext(_ context.Context) (uint64, error) { uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") if err != nil { return 0, err @@ -31,7 +31,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { uvmexp, err := unix.SysctlUvmexp("vm.uvmexp") if err != nil { return nil, err diff --git a/mem/mem_plan9.go b/mem/mem_plan9.go index 4f1990c20..0df0745c7 100644 --- a/mem/mem_plan9.go +++ b/mem/mem_plan9.go @@ -64,6 +64,6 @@ func SwapDevices() ([]*SwapDevice, error) { return SwapDevicesWithContext(context.Background()) } -func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { return nil, common.ErrNotImplementedError } diff --git a/mem/mem_solaris.go b/mem/mem_solaris.go index ca5af4838..e291ed996 100644 --- a/mem/mem_solaris.go +++ b/mem/mem_solaris.go @@ -58,7 +58,7 @@ func SwapMemory() (*SwapMemoryStat, error) { return SwapMemoryWithContext(context.Background()) } -func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { return nil, common.ErrNotImplementedError } diff --git a/mem/mem_windows.go b/mem/mem_windows.go index d7dcef4d7..015c1a19c 100644 --- a/mem/mem_windows.go +++ b/mem/mem_windows.go @@ -37,7 +37,7 @@ func VirtualMemory() (*VirtualMemoryStat, error) { return VirtualMemoryWithContext(context.Background()) } -func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) { +func VirtualMemoryWithContext(_ context.Context) (*VirtualMemoryStat, error) { var memInfo memoryStatusEx memInfo.cbSize = uint32(unsafe.Sizeof(memInfo)) mem, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&memInfo))) @@ -77,7 +77,7 @@ func SwapMemory() (*SwapMemoryStat, error) { return SwapMemoryWithContext(context.Background()) } -func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { +func SwapMemoryWithContext(_ context.Context) (*SwapMemoryStat, error) { // Use the performance counter to get the swap usage percentage counter, err := common.NewWin32PerformanceCounter("swap_percentage", `\Paging File(_Total)\% Usage`) if err != nil { @@ -151,7 +151,7 @@ func SwapDevices() ([]*SwapDevice, error) { return SwapDevicesWithContext(context.Background()) } -func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { +func SwapDevicesWithContext(_ context.Context) ([]*SwapDevice, error) { pageSizeOnce.Do(func() { var sysInfo systemInfo procGetNativeSystemInfo.Call(uintptr(unsafe.Pointer(&sysInfo))) diff --git a/net/net.go b/net/net.go index e114fab44..78798c5a3 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_darwin.go b/net/net_darwin.go index 08266fd90..5814a5484 100644 --- a/net/net_darwin.go +++ b/net/net_darwin.go @@ -163,7 +163,7 @@ func (mapi mapInterfaceNameUsage) notTruncated() []string { } // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } @@ -254,18 +254,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return ret, nil } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCountersWithContext(ctx, pernic) } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } diff --git a/net/net_fallback.go b/net/net_fallback.go index 7d7596a86..29c2a148e 100644 --- a/net/net_fallback.go +++ b/net/net_fallback.go @@ -9,32 +9,32 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, _ bool) ([]IOCountersStat, error) { return []IOCountersStat{}, common.ErrNotImplementedError } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCountersWithContext(ctx, pernic) } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { +func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } diff --git a/net/net_freebsd.go b/net/net_freebsd.go index 33d0f7c63..a72aa00a6 100644 --- a/net/net_freebsd.go +++ b/net/net_freebsd.go @@ -12,7 +12,7 @@ import ( ) // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } @@ -91,18 +91,18 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return ret, nil } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCountersWithContext(ctx, pernic) } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } diff --git a/net/net_linux.go b/net/net_linux.go index 6072965cb..b6e6ec77f 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/net/net_openbsd.go b/net/net_openbsd.go index ed9c506d1..f356fb6f8 100644 --- a/net/net_openbsd.go +++ b/net/net_openbsd.go @@ -107,7 +107,7 @@ func ParseNetstat(output string, mode string, } // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } @@ -157,19 +157,19 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return ret, nil } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(_ context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCounters(pernic) //nolint:contextcheck //FIXME } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } @@ -310,15 +310,15 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, return ret, nil } -func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { +func ConnectionsPidWithContext(_ context.Context, _ string, _ int32) ([]ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { +func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { +func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { return nil, common.ErrNotImplementedError } @@ -338,6 +338,6 @@ func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) } -func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { return nil, common.ErrNotImplementedError } diff --git a/net/net_solaris.go b/net/net_solaris.go index e44979d72..df067806c 100644 --- a/net/net_solaris.go +++ b/net/net_solaris.go @@ -111,28 +111,28 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return ret, nil } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(ctx context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCountersWithContext(ctx, pernic) } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) { +func ConnectionsWithContext(_ context.Context, _ string) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } diff --git a/net/net_unix.go b/net/net_unix.go index 6eb7e2fc5..ae7e9d81a 100644 --- a/net/net_unix.go +++ b/net/net_unix.go @@ -18,7 +18,7 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, return ConnectionsPidWithContext(ctx, kind, 0) } -func ConnectionsMaxWithContext(ctx context.Context, kind string, maxConn int) ([]ConnectionStat, error) { +func ConnectionsMaxWithContext(_ context.Context, _ string, _ int) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } @@ -163,7 +163,7 @@ func parseNetAddr(line string) (laddr Addr, raddr Addr, err error) { return laddr, raddr, err } -func ConnectionsPidMaxWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { +func ConnectionsPidMaxWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } @@ -183,6 +183,6 @@ func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, maxConn) } -func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, maxConn int) ([]ConnectionStat, error) { +func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int32, _ int) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } diff --git a/net/net_windows.go b/net/net_windows.go index d1029cfdd..d7bcf623e 100644 --- a/net/net_windows.go +++ b/net/net_windows.go @@ -138,7 +138,7 @@ type mibIfRow2 struct { OutQLen uint64 } -func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) { +func IOCountersWithContext(_ context.Context, pernic bool) ([]IOCountersStat, error) { ifs, err := net.Interfaces() if err != nil { return nil, err @@ -198,7 +198,7 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, return counters, nil } -func IOCountersByFileWithContext(ctx context.Context, pernic bool, filename string) ([]IOCountersStat, error) { +func IOCountersByFileWithContext(_ context.Context, pernic bool, _ string) ([]IOCountersStat, error) { return IOCounters(pernic) //nolint:contextcheck //FIXME } @@ -206,7 +206,7 @@ func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, return ConnectionsPidWithContext(ctx, kind, 0) } -func ConnectionsPidWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) { +func ConnectionsPidWithContext(_ context.Context, kind string, pid int32) ([]ConnectionStat, error) { tmap, ok := netConnectionKindMap[kind] if !ok { return nil, fmt.Errorf("invalid kind, %s", kind) @@ -258,7 +258,7 @@ func getNetStatWithKind(kindType netConnectionKindType) ([]ConnectionStat, error } // Deprecated: use process.PidsWithContext instead -func PidsWithContext(ctx context.Context) ([]int32, error) { +func PidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } @@ -290,15 +290,15 @@ func connectionsPidMaxWithoutUidsWithContext(_ context.Context, _ string, _ int3 return []ConnectionStat{}, common.ErrNotImplementedError } -func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) { +func FilterCountersWithContext(_ context.Context) ([]FilterStat, error) { return nil, common.ErrNotImplementedError } -func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) { +func ConntrackStatsWithContext(_ context.Context, _ bool) ([]ConntrackStat, error) { return nil, common.ErrNotImplementedError } -func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) { +func ProtoCountersWithContext(_ context.Context, _ []string) ([]ProtoCountersStat, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_bsd.go b/process/process_bsd.go index dcc056101..1a58c3eca 100644 --- a/process/process_bsd.go +++ b/process/process_bsd.go @@ -16,55 +16,55 @@ type MemoryInfoExStat struct{} type MemoryMapsStat struct{} -func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { +func (p *Process) TgidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { +func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { +func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { +func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { +func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { +func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { +func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { +func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { +func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_darwin.go b/process/process_darwin.go index 2c14f2e09..c453b2cdb 100644 --- a/process/process_darwin.go +++ b/process/process_darwin.go @@ -37,7 +37,7 @@ type _Ctype_struct___0 struct { Pad uint64 } -func pidsWithContext(ctx context.Context) ([]int32, error) { +func pidsWithContext(_ context.Context) ([]int32, error) { var ret []int32 kprocs, err := unix.SysctlKinfoProcSlice("kern.proc.all") @@ -52,7 +52,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) { return ret, nil } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -85,7 +85,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) { return name, nil } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -113,7 +113,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { return strings.IndexByte(string(out), '+') != -1, nil } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -125,7 +125,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { return []uint32{userEffectiveUID}, nil } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -137,7 +137,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { return gids, nil } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError // k, err := p.getKProc() // if err != nil { @@ -152,7 +152,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { // return groups, nil } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError /* k, err := p.getKProc() @@ -170,7 +170,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { */ } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -178,7 +178,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { return int32(k.Proc.P_nice), nil } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { return nil, common.ErrNotImplementedError } @@ -304,7 +304,7 @@ func getTimeScaleToNanoSeconds() float64 { return float64(timeBaseInfo.Numer) / float64(timeBaseInfo.Denom) } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { lib, err := registerFuncs() if err != nil { return "", err @@ -333,7 +333,7 @@ type vnodePathInfo struct { // EUID can access. Otherwise "operation not permitted" will be returned as the // error. // Note: This might also work for other *BSD OSs. -func (p *Process) CwdWithContext(ctx context.Context) (string, error) { +func (p *Process) CwdWithContext(_ context.Context) (string, error) { lib, err := registerFuncs() if err != nil { return "", err @@ -430,7 +430,7 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { return strings.Join(r, " "), err } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { lib, err := registerFuncs() if err != nil { return 0, err @@ -443,7 +443,7 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { return int32(ti.Threadnum), nil } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { lib, err := registerFuncs() if err != nil { return nil, err @@ -462,7 +462,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) return ret, nil } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { lib, err := registerFuncs() if err != nil { return nil, err diff --git a/process/process_fallback.go b/process/process_fallback.go index e5410ea04..b01429734 100644 --- a/process/process_fallback.go +++ b/process/process_fallback.go @@ -30,174 +30,174 @@ type MemoryMapsStat struct { type MemoryInfoExStat struct{} -func pidsWithContext(ctx context.Context) ([]int32, error) { +func pidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func ProcessesWithContext(ctx context.Context) ([]*Process, error) { +func ProcessesWithContext(_ context.Context) ([]*Process, error) { return nil, common.ErrNotImplementedError } -func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { +func PidExistsWithContext(_ context.Context, _ int32) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) NameWithContext(ctx context.Context) (string, error) { +func (p *Process) NameWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { +func (p *Process) TgidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { return nil, common.ErrNotImplementedError } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { return 0, common.ErrNotImplementedError } -func (p *Process) CwdWithContext(ctx context.Context) (string, error) { +func (p *Process) CwdWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { return []string{""}, common.ErrNotImplementedError } -func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { +func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { +func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { +func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { +func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { +func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { +func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { +func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { return nil, common.ErrNotImplementedError } -func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { +func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { +func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { +func (p *Process) SendSignalWithContext(_ context.Context, _ Signal) error { return common.ErrNotImplementedError } -func (p *Process) SuspendWithContext(ctx context.Context) error { +func (p *Process) SuspendWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) ResumeWithContext(ctx context.Context) error { +func (p *Process) ResumeWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) TerminateWithContext(ctx context.Context) error { +func (p *Process) TerminateWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) KillWithContext(ctx context.Context) error { +func (p *Process) KillWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { +func (p *Process) UsernameWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { +func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_freebsd.go b/process/process_freebsd.go index a67ac0ef0..6df31421c 100644 --- a/process/process_freebsd.go +++ b/process/process_freebsd.go @@ -34,7 +34,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) { return ret, nil } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -66,7 +66,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) { return name, nil } -func (p *Process) CwdWithContext(ctx context.Context) (string, error) { +func (p *Process) CwdWithContext(_ context.Context) (string, error) { mib := []int32{CTLKern, KernProc, KernProcCwd, p.Pid} buf, length, err := common.CallSyscall(mib) if err != nil { @@ -87,7 +87,7 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) { return cwd, nil } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid} buf, _, err := common.CallSyscall(mib) if err != nil { @@ -97,7 +97,7 @@ func (p *Process) ExeWithContext(ctx context.Context) (string, error) { return strings.Trim(string(buf), "\x00"), nil } -func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} buf, _, err := common.CallSyscall(mib) if err != nil { @@ -110,7 +110,7 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { return strings.Join(ret, " "), nil } -func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { mib := []int32{CTLKern, KernProc, KernProcArgs, p.Pid} buf, _, err := common.CallSyscall(mib) if err != nil { @@ -131,7 +131,7 @@ func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) return strParts, nil } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -139,7 +139,7 @@ func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { return int64(k.Start.Sec)*1000 + int64(k.Start.Usec)/1000, nil } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { k, err := p.getKProc() if err != nil { return []string{""}, err @@ -175,7 +175,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { return strings.IndexByte(string(out), '+') != -1, nil } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -188,7 +188,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { return uids, nil } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -200,7 +200,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { return gids, nil } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -214,7 +214,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { return groups, nil } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { k, err := p.getKProc() if err != nil { return "", err @@ -230,7 +230,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { return termmap[ttyNr], nil } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -238,7 +238,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { return int32(k.Nice), nil } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -249,7 +249,7 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e }, nil } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -258,7 +258,7 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { return k.Numthreads, nil } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -270,7 +270,7 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) }, nil } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { k, err := p.getKProc() 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_openbsd.go b/process/process_openbsd.go index 381b14370..5a6d361db 100644 --- a/process/process_openbsd.go +++ b/process/process_openbsd.go @@ -37,7 +37,7 @@ func pidsWithContext(ctx context.Context) ([]int32, error) { return ret, nil } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -69,7 +69,7 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) { return name, nil } -func (p *Process) CwdWithContext(ctx context.Context) (string, error) { +func (p *Process) CwdWithContext(_ context.Context) (string, error) { mib := []int32{CTLKern, KernProcCwd, p.Pid} buf, _, err := common.CallSyscall(mib) if err != nil { @@ -78,11 +78,11 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) { return common.ByteToString(buf), nil } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { mib := []int32{CTLKern, KernProcArgs, p.Pid, KernProcArgv} buf, _, err := common.CallSyscall(mib) if err != nil { @@ -142,11 +142,11 @@ func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { return strings.Join(argv, " "), nil } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { return 0, common.ErrNotImplementedError } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { k, err := p.getKProc() if err != nil { return []string{""}, err @@ -178,7 +178,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { return strings.IndexByte(string(out), '+') != -1, nil } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -191,7 +191,7 @@ func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { return uids, nil } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -203,7 +203,7 @@ func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { return gids, nil } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -217,7 +217,7 @@ func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { return groups, nil } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { k, err := p.getKProc() if err != nil { return "", err @@ -233,7 +233,7 @@ func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { return termmap[ttyNr], nil } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { k, err := p.getKProc() if err != nil { return 0, err @@ -241,7 +241,7 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { return int32(k.Nice), nil } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -252,12 +252,12 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e }, nil } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { /* not supported, just return 1 */ return 1, nil } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { k, err := p.getKProc() if err != nil { return nil, err @@ -305,11 +305,11 @@ func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { return ret, nil } -func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_plan9.go b/process/process_plan9.go index c82e54a75..7f6877182 100644 --- a/process/process_plan9.go +++ b/process/process_plan9.go @@ -30,174 +30,174 @@ type MemoryMapsStat struct { type MemoryInfoExStat struct{} -func pidsWithContext(ctx context.Context) ([]int32, error) { +func pidsWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func ProcessesWithContext(ctx context.Context) ([]*Process, error) { +func ProcessesWithContext(_ context.Context) ([]*Process, error) { return nil, common.ErrNotImplementedError } -func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { +func PidExistsWithContext(_ context.Context, _ int32) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) NameWithContext(ctx context.Context) (string, error) { +func (p *Process) NameWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { +func (p *Process) TgidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) { +func (p *Process) CmdlineWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) { +func (p *Process) CmdlineSliceWithContext(_ context.Context) ([]string, error) { return nil, common.ErrNotImplementedError } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { return 0, common.ErrNotImplementedError } -func (p *Process) CwdWithContext(ctx context.Context) (string, error) { +func (p *Process) CwdWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { return []string{""}, common.ErrNotImplementedError } -func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { +func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { +func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { +func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { +func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { +func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { +func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { +func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { return nil, common.ErrNotImplementedError } -func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { +func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { +func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) SendSignalWithContext(ctx context.Context, sig Signal) error { +func (p *Process) SendSignalWithContext(_ context.Context, _ Signal) error { return common.ErrNotImplementedError } -func (p *Process) SuspendWithContext(ctx context.Context) error { +func (p *Process) SuspendWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) ResumeWithContext(ctx context.Context) error { +func (p *Process) ResumeWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) TerminateWithContext(ctx context.Context) error { +func (p *Process) TerminateWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) KillWithContext(ctx context.Context) error { +func (p *Process) KillWithContext(_ context.Context) error { return common.ErrNotImplementedError } -func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { +func (p *Process) UsernameWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { +func (p *Process) EnvironWithContext(_ context.Context) ([]string, 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 diff --git a/process/process_solaris.go b/process/process_solaris.go index 279d11ce8..6af5633e0 100644 --- a/process/process_solaris.go +++ b/process/process_solaris.go @@ -52,15 +52,15 @@ func ProcessesWithContext(ctx context.Context) ([]*Process, error) { return out, nil } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) NameWithContext(ctx context.Context) (string, error) { +func (p *Process) NameWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { +func (p *Process) TgidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } @@ -80,7 +80,7 @@ func (p *Process) CmdlineSliceWithContext(ctx context.Context) ([]string, error) return p.fillSliceFromCmdlineWithContext(ctx) } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { return 0, common.ErrNotImplementedError } @@ -88,51 +88,51 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) { return p.fillFromPathCwdWithContext(ctx) } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { return []string{""}, common.ErrNotImplementedError } -func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { +func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { +func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { +func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { +func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { return nil, common.ErrNotImplementedError } @@ -141,55 +141,55 @@ func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { return int32(len(fnames)), err } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { +func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { +func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) { +func (p *Process) ChildrenWithContext(_ context.Context) ([]*Process, error) { return nil, common.ErrNotImplementedError } -func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) { +func (p *Process) OpenFilesWithContext(_ context.Context) ([]OpenFilesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsWithContext(_ context.Context) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { +func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { +func (p *Process) EnvironWithContext(_ context.Context) ([]string, error) { return nil, common.ErrNotImplementedError } diff --git a/process/process_windows.go b/process/process_windows.go index f71cd7e09..30db28404 100644 --- a/process/process_windows.go +++ b/process/process_windows.go @@ -241,7 +241,7 @@ func init() { 0) } -func pidsWithContext(ctx context.Context) ([]int32, error) { +func pidsWithContext(_ context.Context) ([]int32, error) { // inspired by https://gist.github.com/henkman/3083408 // and https://github.com/giampaolo/psutil/blob/1c3a15f637521ba5c0031283da39c733fda53e4c/psutil/arch/windows/process_info.c#L315-L329 var ret []int32 @@ -302,7 +302,7 @@ func PidExistsWithContext(ctx context.Context, pid int32) (bool, error) { return event == uint32(windows.WAIT_TIMEOUT), err } -func (p *Process) PpidWithContext(ctx context.Context) (int32, error) { +func (p *Process) PpidWithContext(_ context.Context) (int32, error) { // if cached already, return from cache cachedPpid := p.getPpid() if cachedPpid != 0 { @@ -336,11 +336,11 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) { return filepath.Base(exe), nil } -func (p *Process) TgidWithContext(ctx context.Context) (int32, error) { +func (p *Process) TgidWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) ExeWithContext(ctx context.Context) (string, error) { +func (p *Process) ExeWithContext(_ context.Context) (string, error) { c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) if err != nil { return "", err @@ -403,7 +403,7 @@ func parseCmdline(cmdline string) ([]string, error) { return argv, nil } -func (p *Process) createTimeWithContext(ctx context.Context) (int64, error) { +func (p *Process) createTimeWithContext(_ context.Context) (int64, error) { ru, err := getRusage(p.Pid) if err != nil { return 0, fmt.Errorf("could not get CreationDate: %w", err) @@ -456,15 +456,15 @@ func (p *Process) CwdWithContext(_ context.Context) (string, error) { return "", nil } -func (p *Process) StatusWithContext(ctx context.Context) ([]string, error) { +func (p *Process) StatusWithContext(_ context.Context) ([]string, error) { return []string{""}, common.ErrNotImplementedError } -func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) { +func (p *Process) ForegroundWithContext(_ context.Context) (bool, error) { return false, common.ErrNotImplementedError } -func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { +func (p *Process) UsernameWithContext(_ context.Context) (string, error) { pid := p.Pid c, err := windows.OpenProcess(processQueryInformation, false, uint32(pid)) if err != nil { @@ -487,19 +487,19 @@ func (p *Process) UsernameWithContext(ctx context.Context) (string, error) { return domain + "\\" + user, err } -func (p *Process) UidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) UidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GidsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GidsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) GroupsWithContext(ctx context.Context) ([]uint32, error) { +func (p *Process) GroupsWithContext(_ context.Context) ([]uint32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TerminalWithContext(ctx context.Context) (string, error) { +func (p *Process) TerminalWithContext(_ context.Context) (string, error) { return "", common.ErrNotImplementedError } @@ -515,7 +515,7 @@ var priorityClasses = map[int]int32{ 0x00000100: 24, // REALTIME_PRIORITY_CLASS } -func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { +func (p *Process) NiceWithContext(_ context.Context) (int32, error) { c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) if err != nil { return 0, err @@ -532,19 +532,19 @@ func (p *Process) NiceWithContext(ctx context.Context) (int32, error) { return priority, nil } -func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) { +func (p *Process) IOniceWithContext(_ context.Context) (int32, error) { return 0, common.ErrNotImplementedError } -func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) { +func (p *Process) RlimitWithContext(_ context.Context) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) { +func (p *Process) RlimitUsageWithContext(_ context.Context, _ bool) ([]RlimitStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, error) { +func (p *Process) IOCountersWithContext(_ context.Context) (*IOCountersStat, error) { c, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) if err != nil { return nil, err @@ -565,13 +565,13 @@ func (p *Process) IOCountersWithContext(ctx context.Context) (*IOCountersStat, e return stats, nil } -func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) { +func (p *Process) NumCtxSwitchesWithContext(_ context.Context) (*NumCtxSwitchesStat, error) { return nil, common.ErrNotImplementedError } // NumFDsWithContext returns the number of handles for a process on Windows, // not the number of file descriptors (FDs). -func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumFDsWithContext(_ context.Context) (int32, error) { handle, err := windows.OpenProcess(processQueryInformation, false, uint32(p.Pid)) if err != nil { return 0, err @@ -586,7 +586,7 @@ func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) { return int32(handleCount), nil } -func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { +func (p *Process) NumThreadsWithContext(_ context.Context) (int32, error) { ppid, ret, _, err := getFromSnapProcess(p.Pid) if err != nil { return 0, err @@ -601,11 +601,11 @@ func (p *Process) NumThreadsWithContext(ctx context.Context) (int32, error) { return ret, nil } -func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) { +func (p *Process) ThreadsWithContext(_ context.Context) (map[int32]*cpu.TimesStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) { +func (p *Process) TimesWithContext(_ context.Context) (*cpu.TimesStat, error) { sysTimes, err := getProcessCPUTimes(p.Pid) if err != nil { return nil, err @@ -629,11 +629,11 @@ func (p *Process) TimesWithContext(ctx context.Context) (*cpu.TimesStat, error) }, nil } -func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) { +func (p *Process) CPUAffinityWithContext(_ context.Context) ([]int32, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, error) { +func (p *Process) MemoryInfoWithContext(_ context.Context) (*MemoryInfoStat, error) { mem, err := getMemoryInfo(p.Pid) if err != nil { return nil, err @@ -647,11 +647,11 @@ func (p *Process) MemoryInfoWithContext(ctx context.Context) (*MemoryInfoStat, e return ret, nil } -func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) { +func (p *Process) MemoryInfoExWithContext(_ context.Context) (*MemoryInfoExStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) { +func (p *Process) PageFaultsWithContext(_ context.Context) (*PageFaultsStat, error) { return nil, common.ErrNotImplementedError } @@ -778,19 +778,19 @@ func (p *Process) ConnectionsWithContext(ctx context.Context) ([]net.ConnectionS return net.ConnectionsPidWithContext(ctx, "all", p.Pid) } -func (p *Process) ConnectionsMaxWithContext(ctx context.Context, maxConn int) ([]net.ConnectionStat, error) { +func (p *Process) ConnectionsMaxWithContext(_ context.Context, _ int) ([]net.ConnectionStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) { +func (p *Process) MemoryMapsWithContext(_ context.Context, _ bool) (*[]MemoryMapsStat, error) { return nil, common.ErrNotImplementedError } -func (p *Process) SendSignalWithContext(ctx context.Context, sig syscall.Signal) error { +func (p *Process) SendSignalWithContext(_ context.Context, _ syscall.Signal) error { return common.ErrNotImplementedError } -func (p *Process) SuspendWithContext(ctx context.Context) error { +func (p *Process) SuspendWithContext(_ context.Context) error { c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) if err != nil { return err @@ -806,7 +806,7 @@ func (p *Process) SuspendWithContext(ctx context.Context) error { return nil } -func (p *Process) ResumeWithContext(ctx context.Context) error { +func (p *Process) ResumeWithContext(_ context.Context) error { c, err := windows.OpenProcess(windows.PROCESS_SUSPEND_RESUME, false, uint32(p.Pid)) if err != nil { return err @@ -822,7 +822,7 @@ func (p *Process) ResumeWithContext(ctx context.Context) error { return nil } -func (p *Process) TerminateWithContext(ctx context.Context) error { +func (p *Process) TerminateWithContext(_ context.Context) error { proc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, false, uint32(p.Pid)) if err != nil { return err @@ -832,7 +832,7 @@ func (p *Process) TerminateWithContext(ctx context.Context) error { return err } -func (p *Process) KillWithContext(ctx context.Context) error { +func (p *Process) KillWithContext(_ context.Context) error { process, err := os.FindProcess(int(p.Pid)) if err != nil { return err diff --git a/sensors/sensors_darwin.go b/sensors/sensors_darwin.go index 23a3a7a1e..fa091c0a8 100644 --- a/sensors/sensors_darwin.go +++ b/sensors/sensors_darwin.go @@ -11,7 +11,7 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { ioKit, err := common.NewLibrary(common.IOKit) if err != nil { return nil, err diff --git a/sensors/sensors_darwin_arm64.go b/sensors/sensors_darwin_arm64.go index 37158323e..8dcf0ea80 100644 --- a/sensors/sensors_darwin_arm64.go +++ b/sensors/sensors_darwin_arm64.go @@ -15,7 +15,7 @@ func ReadTemperaturesArm() []TemperatureStat { return temperatures } -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { ioKit, err := common.NewLibrary(common.IOKit) if err != nil { return nil, err diff --git a/sensors/sensors_fallback.go b/sensors/sensors_fallback.go index ec5c0c5b2..24db26970 100644 --- a/sensors/sensors_fallback.go +++ b/sensors/sensors_fallback.go @@ -9,6 +9,6 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { return []TemperatureStat{}, common.ErrNotImplementedError } diff --git a/sensors/sensors_freebsd.go b/sensors/sensors_freebsd.go index f4b6f04d5..6709ae0bb 100644 --- a/sensors/sensors_freebsd.go +++ b/sensors/sensors_freebsd.go @@ -9,6 +9,6 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { return []TemperatureStat{}, common.ErrNotImplementedError } diff --git a/sensors/sensors_netbsd.go b/sensors/sensors_netbsd.go index f2e2f7f2a..cf878dffd 100644 --- a/sensors/sensors_netbsd.go +++ b/sensors/sensors_netbsd.go @@ -9,6 +9,6 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { return []TemperatureStat{}, common.ErrNotImplementedError } diff --git a/sensors/sensors_openbsd.go b/sensors/sensors_openbsd.go index 1b1309539..dfa17e70b 100644 --- a/sensors/sensors_openbsd.go +++ b/sensors/sensors_openbsd.go @@ -9,6 +9,6 @@ import ( "github.com/shirou/gopsutil/v4/internal/common" ) -func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) { +func TemperaturesWithContext(_ context.Context) ([]TemperatureStat, error) { return []TemperatureStat{}, common.ErrNotImplementedError } diff --git a/winservices/winservices.go b/winservices/winservices.go index 1c062652d..1c1e1ed35 100644 --- a/winservices/winservices.go +++ b/winservices/winservices.go @@ -72,7 +72,7 @@ func (s *Service) QueryServiceConfig() (mgr.Config, error) { // QueryServiceConfigWithContext call QueryServiceConfig() and QueryServiceConfig2() // implement windows https://msdn.microsoft.com/en-us/library/windows/desktop/ms684932(v=vs.85).aspx -func (s *Service) QueryServiceConfigWithContext(ctx context.Context) (mgr.Config, error) { +func (s *Service) QueryServiceConfigWithContext(_ context.Context) (mgr.Config, error) { return s.srv.Config() } @@ -82,7 +82,7 @@ func (s *Service) QueryStatus() (ServiceStatus, error) { } // QueryStatusWithContext return the specified name service currentState and ControlsAccepted -func (s *Service) QueryStatusWithContext(ctx context.Context) (ServiceStatus, error) { +func (s *Service) QueryStatusWithContext(_ context.Context) (ServiceStatus, error) { var p *windows.SERVICE_STATUS_PROCESS var bytesNeeded uint32 var buf []byte