From fec541e5650e819a730a7900e7f41b22105b178d Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Tue, 31 May 2022 18:02:19 +0800 Subject: [PATCH] code refactor --- config/hostname.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/hostname.go b/config/hostname.go index b5215414..42c2261d 100644 --- a/config/hostname.go +++ b/config/hostname.go @@ -41,12 +41,12 @@ func InitHostname() error { name: hostname, } - go loopUpdateHostname() + go Hostname.update() return nil } -func loopUpdateHostname() { +func (c *HostnameCache) update() { for { time.Sleep(time.Second) name, err := os.Hostname()