21 lines
347 B
Go
21 lines
347 B
Go
package main
|
|
|
|
import "syscall"
|
|
|
|
func unameRelease() string {
|
|
uname := &syscall.Utsname{}
|
|
if err := syscall.Uname(uname); err != nil {
|
|
fatalf("failed to get kernel version: %v", err)
|
|
}
|
|
|
|
ba := make([]byte, 0, len(uname.Release))
|
|
for _, c := range uname.Release {
|
|
if c == 0 {
|
|
break
|
|
}
|
|
ba = append(ba, byte(c))
|
|
}
|
|
|
|
return string(ba)
|
|
}
|