提交 bfe7890e 编写于 作者: W WAKAYAMA shirou

fix return type.

上级 dc78f4bc
......@@ -6,26 +6,26 @@ import (
"strconv"
)
func LoadAvg() (LoadAvgStat, error) {
func LoadAvg() (*LoadAvgStat, error) {
values, err := doSysctrl("vm.loadavg")
if err != nil {
return LoadAvgStat{}, err
return nil, err
}
load1, err := strconv.ParseFloat(values[0], 64)
if err != nil {
return LoadAvgStat{}, err
return nil, err
}
load5, err := strconv.ParseFloat(values[1], 64)
if err != nil {
return LoadAvgStat{}, err
return nil, err
}
load15, err := strconv.ParseFloat(values[2], 64)
if err != nil {
return LoadAvgStat{}, err
return nil, err
}
ret := LoadAvgStat{
ret := &LoadAvgStat{
Load1: float64(load1),
Load5: float64(load5),
Load15: float64(load15),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册