diff --git a/cmd/init.go b/cmd/init.go index 40b578492..f5c481a04 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -701,24 +701,22 @@ func initBounceManager(app *App) *bounce.Manager { func initAbout(q *models.Queries, db *sqlx.DB) about { var ( - mem runtime.MemStats - utsname syscall.Utsname + mem runtime.MemStats ) // Memory / alloc stats. runtime.ReadMemStats(&mem) - // OS info. - if err := syscall.Uname(&utsname); err != nil { - lo.Printf("WARNING: error getting system info: %v", err) - } - - // DB dbv. info := types.JSONText(`{}`) if err := db.QueryRow(q.GetDBInfo).Scan(&info); err != nil { lo.Printf("WARNING: error getting database version: %v", err) } + hostname, err := os.Hostname() + if err != nil { + lo.Printf("WARNING: error getting hostname: %v", err) + } + return about{ Version: versionString, Build: buildString, @@ -729,10 +727,9 @@ func initAbout(q *models.Queries, db *sqlx.DB) about { NumCPU: runtime.NumCPU(), }, Host: aboutHost{ - OS: int8ToStr(utsname.Sysname[:]), - OSRelease: int8ToStr(utsname.Release[:]), - Machine: int8ToStr(utsname.Machine[:]), - Hostname: int8ToStr(utsname.Nodename[:]), + OS: runtime.GOOS, + Machine: runtime.GOARCH, + Hostname: hostname, }, } diff --git a/cmd/settings.go b/cmd/settings.go index 0eb099389..cbef53250 100644 --- a/cmd/settings.go +++ b/cmd/settings.go @@ -24,10 +24,9 @@ import ( const pwdMask = "•" type aboutHost struct { - OS string `json:"os"` - OSRelease string `json:"os_release"` - Machine string `json:"arch"` - Hostname string `json:"hostname"` + OS string `json:"os"` + Machine string `json:"arch"` + Hostname string `json:"hostname"` } type aboutSystem struct { NumCPU int `json:"num_cpu"` diff --git a/cmd/utils.go b/cmd/utils.go index ef2b6f2d9..65b9df8f1 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -101,11 +101,6 @@ func strSliceContains(str string, sl []string) bool { return false } -func int8ToStr(bs []int8) string { - b := make([]byte, len(bs)) - for i, v := range bs { - b[i] = byte(v) - } - +func trimNullBytes(b []byte) string { return string(bytes.Trim(b, "\x00")) }