Chore: pass staticcheck
This commit is contained in:
@ -32,18 +32,18 @@ func initMMDB() error {
|
||||
if _, err := os.Stat(C.Path.MMDB()); os.IsNotExist(err) {
|
||||
log.Infoln("Can't find MMDB, start download")
|
||||
if err := downloadMMDB(C.Path.MMDB()); err != nil {
|
||||
return fmt.Errorf("Can't download MMDB: %s", err.Error())
|
||||
return fmt.Errorf("can't download MMDB: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if !mmdb.Verify() {
|
||||
log.Warnln("MMDB invalid, remove and download")
|
||||
if err := os.Remove(C.Path.MMDB()); err != nil {
|
||||
return fmt.Errorf("Can't remove invalid MMDB: %s", err.Error())
|
||||
return fmt.Errorf("can't remove invalid MMDB: %s", err.Error())
|
||||
}
|
||||
|
||||
if err := downloadMMDB(C.Path.MMDB()); err != nil {
|
||||
return fmt.Errorf("Can't download MMDB: %s", err.Error())
|
||||
return fmt.Errorf("can't download MMDB: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ func Init(dir string) error {
|
||||
// initial homedir
|
||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(dir, 0777); err != nil {
|
||||
return fmt.Errorf("Can't create config directory %s: %s", dir, err.Error())
|
||||
return fmt.Errorf("can't create config directory %s: %s", dir, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ func Init(dir string) error {
|
||||
log.Infoln("Can't find config, create a initial config file")
|
||||
f, err := os.OpenFile(C.Path.Config(), os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't create file %s: %s", C.Path.Config(), err.Error())
|
||||
return fmt.Errorf("can't create file %s: %s", C.Path.Config(), err.Error())
|
||||
}
|
||||
f.Write([]byte(`port: 7890`))
|
||||
f.Close()
|
||||
@ -72,7 +72,7 @@ func Init(dir string) error {
|
||||
|
||||
// initial mmdb
|
||||
if err := initMMDB(); err != nil {
|
||||
return fmt.Errorf("Can't initial MMDB: %w", err)
|
||||
return fmt.Errorf("can't initial MMDB: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user