Re-use err variable, instead of creating new error vars
This commit is contained in:
parent
baaf0580f5
commit
7a84d27dca
18
app.go
18
app.go
|
@ -513,9 +513,9 @@ requests. We recommend supplying a valid host name.`)
|
||||||
|
|
||||||
// old sockets will remain after server closes;
|
// old sockets will remain after server closes;
|
||||||
// we need to delete them in order to open new ones
|
// we need to delete them in order to open new ones
|
||||||
removeSocketErr := os.Remove(bindAddress)
|
err = os.Remove(bindAddress)
|
||||||
if removeSocketErr != nil && !os.IsNotExist(removeSocketErr) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
log.Error("%s already exists but could not be removed: %v", bindAddress, removeSocketErr)
|
log.Error("%s already exists but could not be removed: %v", bindAddress, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -526,16 +526,16 @@ requests. We recommend supplying a valid host name.`)
|
||||||
|
|
||||||
log.Info("Serving on %s://%s", protocol, bindAddress)
|
log.Info("Serving on %s://%s", protocol, bindAddress)
|
||||||
log.Info("---")
|
log.Info("---")
|
||||||
listener, listenErr := net.Listen(network, bindAddress)
|
listener, err := net.Listen(network, bindAddress)
|
||||||
if listenErr != nil {
|
if err != nil {
|
||||||
log.Error("Could not bind to address: %v", listenErr)
|
log.Error("Could not bind to address: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if network == "unix" {
|
if network == "unix" {
|
||||||
chmodSocketErr := os.Chmod(bindAddress, 0o666)
|
err = os.Chmod(bindAddress, 0o666)
|
||||||
if chmodSocketErr != nil {
|
if err != nil {
|
||||||
log.Error("Could not update socket permissions: %v", chmodSocketErr)
|
log.Error("Could not update socket permissions: %v", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue