aboutsummaryrefslogtreecommitdiff
path: root/cmd/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/main.go')
-rw-r--r--cmd/main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/main.go b/cmd/main.go
new file mode 100644
index 0000000..56d0992
--- /dev/null
+++ b/cmd/main.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/shirou/gopsutil/v3/disk"
+ // "github.com/shirou/gopsutil/mem" // to use v2
+)
+
+func main() {
+ v, _ := disk.Partitions(false)
+
+ // almost every return value is a struct
+ //fmt.Printf("Total: %v, Free:%v, UsedPercent:%f%%\n", v.Total, v.Free, v.UsedPercent)
+
+ // convert to JSON. String() is also implemented
+ fmt.Println(v)
+}