func main() { fslist := gosigar.FileSystemList{} fslist.Get() fmt.Fprintf(os.Stdout, output_format, "Filesystem", "Size", "Used", "Avail", "Use%", "Mounted on") for _, fs := range fslist.List { dir_name := fs.DirName usage := gosigar.FileSystemUsage{} usage.Get(dir_name) fmt.Fprintf(os.Stdout, output_format, fs.DevName, gosigar.FormatSize(usage.Total), gosigar.FormatSize(usage.Used), gosigar.FormatSize(usage.Avail), gosigar.FormatPercent(usage.UsePercent()), dir_name) } }
func formatSize(size uint64) string { return gosigar.FormatSize(size * 1024) }