mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 11:30:18 +00:00
Re-use err variable, instead of creating new error vars
This commit is contained in:
parent
baaf0580f5
commit
7a84d27dca
1 changed files with 9 additions and 9 deletions
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;
|
||||
// we need to delete them in order to open new ones
|
||||
removeSocketErr := os.Remove(bindAddress)
|
||||
if removeSocketErr != nil && !os.IsNotExist(removeSocketErr) {
|
||||
log.Error("%s already exists but could not be removed: %v", bindAddress, removeSocketErr)
|
||||
err = os.Remove(bindAddress)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Error("%s already exists but could not be removed: %v", bindAddress, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
} else {
|
||||
|
@ -526,16 +526,16 @@ requests. We recommend supplying a valid host name.`)
|
|||
|
||||
log.Info("Serving on %s://%s", protocol, bindAddress)
|
||||
log.Info("---")
|
||||
listener, listenErr := net.Listen(network, bindAddress)
|
||||
if listenErr != nil {
|
||||
log.Error("Could not bind to address: %v", listenErr)
|
||||
listener, err := net.Listen(network, bindAddress)
|
||||
if err != nil {
|
||||
log.Error("Could not bind to address: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if network == "unix" {
|
||||
chmodSocketErr := os.Chmod(bindAddress, 0o666)
|
||||
if chmodSocketErr != nil {
|
||||
log.Error("Could not update socket permissions: %v", chmodSocketErr)
|
||||
err = os.Chmod(bindAddress, 0o666)
|
||||
if err != nil {
|
||||
log.Error("Could not update socket permissions: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue