mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-24 13:48:56 +08:00
fix more linting reports
This commit is contained in:
parent
842e4da755
commit
b712e59295
@ -6,8 +6,9 @@ package disk
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
// PartitionsWithContext returns disk partition.
|
||||
|
@ -3,7 +3,10 @@
|
||||
|
||||
package docker
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetDockerIDList(t *testing.T) {
|
||||
// If there is not docker environment, this test always fail.
|
||||
@ -43,7 +46,7 @@ func TestGetDockerStat(t *testing.T) {
|
||||
func TestCgroupCPU(t *testing.T) {
|
||||
v, _ := GetDockerIDList()
|
||||
for _, id := range v {
|
||||
v, err := CgroupCPUDocker(id)
|
||||
v, err := CgroupCPUDockerWithContext(context.Background(), id)
|
||||
if err != nil {
|
||||
t.Errorf("error %v", err)
|
||||
}
|
||||
@ -55,7 +58,7 @@ func TestCgroupCPU(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCgroupCPUInvalidId(t *testing.T) {
|
||||
_, err := CgroupCPUDocker("bad id")
|
||||
_, err := CgroupCPUDockerWithContext(context.Background(), "bad id")
|
||||
if err == nil {
|
||||
t.Error("Expected path does not exist error")
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func CgroupCPUDocker(containerid string) (*CgroupCPUStat, error) {
|
||||
}
|
||||
|
||||
func CgroupCPUDockerWithContext(ctx context.Context, containerid string) (*CgroupCPUStat, error) {
|
||||
return CgroupCPU(containerid, common.HostSysWithContext(ctx, "fs/cgroup/cpuacct/docker"))
|
||||
return CgroupCPUWithContext(ctx, containerid, common.HostSysWithContext(ctx, "fs/cgroup/cpuacct/docker"))
|
||||
}
|
||||
|
||||
func CgroupMem(containerid string, base string) (*CgroupMemStat, error) {
|
||||
|
@ -13,9 +13,10 @@ import (
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"github.com/shirou/gopsutil/v3/process"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// from utmpx.h
|
||||
|
@ -8,8 +8,9 @@ import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
)
|
||||
|
||||
func getHwMemsize() (uint64, error) {
|
||||
|
@ -10,10 +10,11 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"github.com/shirou/gopsutil/v3/net"
|
||||
"github.com/tklauser/go-sysconf"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"github.com/shirou/gopsutil/v3/net"
|
||||
)
|
||||
|
||||
// copied from sys/sysctl.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user