Fix deferInLoop error (#10387)
Signed-off-by: z1cheng <imchench@gmail.com>
This commit is contained in:
parent
fb7f92a7d5
commit
93e006c2ce
1 changed files with 11 additions and 12 deletions
|
@ -179,20 +179,19 @@ func downloadDatabase(dbName string) error {
|
|||
if !strings.HasSuffix(header.Name, mmdbFile) {
|
||||
continue
|
||||
}
|
||||
|
||||
return func() error {
|
||||
outFile, err := os.Create(path.Join(geoIPPath, mmdbFile))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//nolint:gocritic // TODO: will fix it on a followup PR
|
||||
defer outFile.Close()
|
||||
|
||||
if _, err := io.CopyN(outFile, tarReader, header.Size); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue