git » systemd » commit 819a282

Minor style and simplification cleanups

author Alberto Bertogli
2016-08-01 21:49:27 UTC
committer Alberto Bertogli
2016-09-12 03:06:56 UTC
parent 50243e46a413e08344e6a84cd9b480d38cb25608

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.

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