author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-08-01 21:49:27 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-09-12 03:06:56 UTC |
parent | 50243e46a413e08344e6a84cd9b480d38cb25608 |
systemd.go | +2 | -2 |
systemd_test.go | +1 | -1 |
diff --git a/systemd.go b/systemd.go index a6a796c..4cbaf5e 100644 --- a/systemd.go +++ b/systemd.go @@ -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")) diff --git a/systemd_test.go b/systemd_test.go index 28586fe..34bca4b 100644 --- a/systemd_test.go +++ b/systemd_test.go @@ -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) } }