diff --git a/config/config.go b/config/config.go index 882b2380..736e16d8 100644 --- a/config/config.go +++ b/config/config.go @@ -208,10 +208,6 @@ func (c *ConfigType) GetHostIP() string { } func (c *ConfigType) GetHostSN() string { ret := HostInfo.GetSN() - if ret == "" { - return c.GetHostname() - } - return ret } func GetEnv(key string) string { diff --git a/config/hostname.go b/config/hostname.go index f9a151c9..bc5635c5 100644 --- a/config/hostname.go +++ b/config/hostname.go @@ -83,10 +83,8 @@ func InitHostInfo() error { ip = fmt.Sprint(nip) } var sn string - sn, err = GetBiosSn() - if err != nil { - return err - } + // allow sn empty + sn, _ = GetBiosSn() HostInfo = &HostInfoCache{ name: hostname, ip: fmt.Sprint(ip),