mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 12:48:00 +00:00
fix(check-ip): explicit error handling for UserCacheDir + geo.Close
This commit is contained in:
parent
b61ca0aa94
commit
0c281a494b
@ -44,7 +44,11 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if cacheDir == "" {
|
if cacheDir == "" {
|
||||||
cacheDir, _ = os.UserCacheDir()
|
d, err := os.UserCacheDir()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("cache-dir: %v", err)
|
||||||
|
}
|
||||||
|
cacheDir = d
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||||
@ -80,7 +84,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("geoip: %v", err)
|
log.Fatalf("geoip: %v", err)
|
||||||
}
|
}
|
||||||
defer geo.Close()
|
defer func() { _ = geo.Close() }()
|
||||||
|
|
||||||
if bind == "" {
|
if bind == "" {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user