mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-15 23:36:26 +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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = executeDirectives(inst, cdyfile.Path(), stype.Directives(), sblocks, justValidate)
|
return executeDirectives(inst, cdyfile.Path(), stype.Directives(), sblocks, justValidate)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeDirectives(inst *Instance, filename string,
|
func executeDirectives(inst *Instance, filename string,
|
||||||
|
|
|
@ -84,7 +84,7 @@ func trapSignalsPosix() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kick off the restart; our work is done
|
// Kick off the restart; our work is done
|
||||||
inst, err = inst.Restart(caddyfileToUse)
|
_, err = inst.Restart(caddyfileToUse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] SIGUSR1: %v", err)
|
log.Printf("[ERROR] SIGUSR1: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ func Upgrade() error {
|
||||||
|
|
||||||
// determine whether child startup succeeded
|
// determine whether child startup succeeded
|
||||||
answer, readErr := ioutil.ReadAll(sigrpipe)
|
answer, readErr := ioutil.ReadAll(sigrpipe)
|
||||||
if answer == nil || len(answer) == 0 {
|
if len(answer) == 0 {
|
||||||
cmdErr := cmd.Wait() // get exit status
|
cmdErr := cmd.Wait() // get exit status
|
||||||
errStr := fmt.Sprintf("child failed to initialize: %v", cmdErr)
|
errStr := fmt.Sprintf("child failed to initialize: %v", cmdErr)
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
|
|
Loading…
Reference in a new issue