Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
In [4]:
import "fmt"
import "runtime"
import "os/exec"
import "periph.io/x/host/v3/distro"
In [2]:
runtime.GOOS
Out[2]:
List all support OS by Golang.
In [8]:
out, err := exec.Command("bash", "-c", "go tool dist list").Output()
string(out)
Out[8]:
Get Linux Distribution Information¶
In [5]:
for k, v := range distro.OSRelease() {
fmt.Printf("%s: %s\n", k, v)
}
In [ ]: