mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-09 17:55:57 +00:00
Minor style and simplification cleanups
This patch does various minor style and simplification cleanups, fixing things detected by tools such as go vet, gofmt -s, and golint. There are no functional changes, this change is purely cosmetic, but will enable us to run those tools more regularly now that their output is clean.
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
var (
|
||||
// Error to return when $LISTEN_PID does not refer to us.
|
||||
PIDMismatch = errors.New("$LISTEN_PID != our PID")
|
||||
ErrPIDMismatch = errors.New("$LISTEN_PID != our PID")
|
||||
|
||||
// First FD for listeners.
|
||||
// It's 3 by definition, but using a variable simplifies testing.
|
||||
@@ -36,7 +36,7 @@ func Listeners() ([]net.Listener, error) {
|
||||
return nil, fmt.Errorf(
|
||||
"error converting $LISTEN_PID=%q: %v", pidStr, err)
|
||||
} else if pid != os.Getpid() {
|
||||
return nil, PIDMismatch
|
||||
return nil, ErrPIDMismatch
|
||||
}
|
||||
|
||||
nfds, err := strconv.Atoi(os.Getenv("LISTEN_FDS"))
|
||||
|
||||
@@ -53,7 +53,7 @@ func TestWrongPID(t *testing.T) {
|
||||
}
|
||||
|
||||
setenv(strconv.Itoa(pid), "4")
|
||||
if _, err := Listeners(); err != PIDMismatch {
|
||||
if _, err := Listeners(); err != ErrPIDMismatch {
|
||||
t.Errorf("Did not fail with PID mismatch: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user