1
0
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:
Alberto Bertogli
2016-08-01 22:49:27 +01:00
parent 92a88bd06f
commit aac2d3c061
11 changed files with 37 additions and 37 deletions

View File

@@ -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"))

View File

@@ -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)
}
}