mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
a few code improvements (#1936)
caddy.go:569: could be simplified sigtrap_posix.go:87: value of inst is never used upgrade.go:151: should omit nil check; len() for nil slices is defined as zero
This commit is contained in:
parent
f7a70266ed
commit
ac1f3bfaaa
3 changed files with 3 additions and 8 deletions
7
caddy.go
7
caddy.go
|
@ -565,12 +565,7 @@ func ValidateAndExecuteDirectives(cdyfile Input, inst *Instance, justValidate bo
|
|||
return err
|
||||
}
|
||||
|
||||
err = executeDirectives(inst, cdyfile.Path(), stype.Directives(), sblocks, justValidate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return executeDirectives(inst, cdyfile.Path(), stype.Directives(), sblocks, justValidate)
|
||||
}
|
||||
|
||||
func executeDirectives(inst *Instance, filename string,
|
||||
|
|
|
@ -84,7 +84,7 @@ func trapSignalsPosix() {
|
|||
}
|
||||
|
||||
// Kick off the restart; our work is done
|
||||
inst, err = inst.Restart(caddyfileToUse)
|
||||
_, err = inst.Restart(caddyfileToUse)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] SIGUSR1: %v", err)
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ func Upgrade() error {
|
|||
|
||||
// determine whether child startup succeeded
|
||||
answer, readErr := ioutil.ReadAll(sigrpipe)
|
||||
if answer == nil || len(answer) == 0 {
|
||||
if len(answer) == 0 {
|
||||
cmdErr := cmd.Wait() // get exit status
|
||||
errStr := fmt.Sprintf("child failed to initialize: %v", cmdErr)
|
||||
if readErr != nil {
|
||||
|
|
Loading…
Reference in a new issue