提交 ce819755 编写于 作者: W WAKAYAMA Shirou

add windows stub.

上级 4ffbd2a2
// +build windows
package main
import (
"fmt"
)
func (c CPU) Cpu_times() ([]CPU_Times, error) {
ret := make([]CPU_Times, 0)
fmt.Println("Windows")
return ret, nil
}
// +build windows
package main
func (d Disk) Disk_usage(path string) (Disk_usage, error) {
ret := Disk_usage{}
return ret, nil
}
// +build linux freebsd
package main
import (
"os"
"syscall"
)
func (h Host) HostInfo() (HostInfo, error) {
ret := HostInfo{}
hostname, err := os.Hostname()
ret.Hostname = hostname
ret.Uptime = sysinfo.Uptime
return ret, nil
}
// +build windows
package main
import (
"os"
)
func (h Host) HostInfo() (HostInfo, error) {
ret := HostInfo{}
hostname, err := os.Hostname()
if err != nil {
return ret, err
}
ret.Hostname = hostname
return ret, nil
}
// +build windows
package main
func (l Load) LoadAvg() (LoadAvg, error) {
ret := LoadAvg{}
return ret, nil
}
// +build windows
package main
func (m Mem) Virtual_memory() (Virtual_memory, error) {
ret := Virtual_memory{}
return ret, nil
}
func (m Mem) Swap_memory() (Swap_memory, error) {
ret := Swap_memory{}
return ret, nil
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册