mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-29 13:49:21 +08:00
lint
This commit is contained in:
parent
a48fd71137
commit
ca71a6db3c
@ -73,7 +73,8 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) {
|
||||
|
||||
if useStatFile {
|
||||
return readBootTimeStat(ctx)
|
||||
} else {
|
||||
}
|
||||
|
||||
filename := HostProcWithContext(ctx, "uptime")
|
||||
lines, err := ReadLines(filename)
|
||||
if err != nil {
|
||||
@ -90,7 +91,6 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) {
|
||||
currentTime := float64(time.Now().UnixNano()) / float64(time.Second)
|
||||
t := currentTime - b
|
||||
return uint64(t), nil
|
||||
}
|
||||
}
|
||||
|
||||
func handleBootTimeFileReadErr(err error) (uint64, error) {
|
||||
@ -102,7 +102,7 @@ func handleBootTimeFileReadErr(err error) (uint64, error) {
|
||||
}
|
||||
|
||||
currentTime := time.Now().UnixNano() / int64(time.Second)
|
||||
t := currentTime - info.Uptime
|
||||
t := currentTime - int64(info.Uptime)
|
||||
return uint64(t), nil
|
||||
}
|
||||
return 0, err
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/internal/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var mu sync.Mutex
|
||||
|
Loading…
x
Reference in New Issue
Block a user