move lang.Must into logx.Must to make sure output fatal message as json
This commit is contained in:
@@ -3,7 +3,7 @@ package sysx
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/tal-tech/go-zero/core/lang"
|
||||
"github.com/tal-tech/go-zero/core/stringx"
|
||||
)
|
||||
|
||||
var hostname string
|
||||
@@ -11,7 +11,9 @@ var hostname string
|
||||
func init() {
|
||||
var err error
|
||||
hostname, err = os.Hostname()
|
||||
lang.Must(err)
|
||||
if err != nil {
|
||||
hostname = stringx.RandId()
|
||||
}
|
||||
}
|
||||
|
||||
func Hostname() string {
|
||||
|
||||
Reference in New Issue
Block a user