diff --git a/src/common/tools/hosts.go b/src/common/tools/hosts.go index 0c61c247b053df17b0d8d2bcc3f6f85090d01662..210f71a35f5c0d36bc17e96c82e528a7955213d6 100644 --- a/src/common/tools/hosts.go +++ b/src/common/tools/hosts.go @@ -2,7 +2,6 @@ package tools import ( "bufio" - "log" "os" "strings" ) @@ -12,11 +11,7 @@ func HostsToJson() (data map[string][]string, err error) { if err != nil { return nil, err } - defer func() { - if err = f.Close(); err != nil { - log.Fatal(err) - } - }() + defer f.Close() data = make(map[string][]string) // 以这个文件为参数,创建一个 scanner s := bufio.NewScanner(f)