From c67dbb0ebd3513a7b7d23596cfc010d2f0a69d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 2 Feb 2016 09:25:29 +0100 Subject: [PATCH] go1.3 compat --- server.go | 4 ++-- unsetenv.go | 9 +++++++++ unsetenv_13.go | 9 +++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 unsetenv.go create mode 100644 unsetenv_13.go diff --git a/server.go b/server.go index c4e05c3..5421720 100644 --- a/server.go +++ b/server.go @@ -91,8 +91,8 @@ func parseFlags() options { } func Listeners() []*net.TCPListener { - defer os.Unsetenv("LISTEN_PID") - defer os.Unsetenv("LISTEN_FDS") + defer unsetenv("LISTEN_PID") + defer unsetenv("LISTEN_FDS") pid, err := strconv.Atoi(os.Getenv("LISTEN_PID")) if err != nil || pid != os.Getpid() { diff --git a/unsetenv.go b/unsetenv.go new file mode 100644 index 0000000..0c89d5e --- /dev/null +++ b/unsetenv.go @@ -0,0 +1,9 @@ +// +build go1.4 + +package main + +import "os" + +func unsetenv(key string) { + os.Unsetenv(key) +} diff --git a/unsetenv_13.go b/unsetenv_13.go new file mode 100644 index 0000000..5245409 --- /dev/null +++ b/unsetenv_13.go @@ -0,0 +1,9 @@ +// +build !go1.4 + +package main + +import "os" + +func unsetenv(key string) { + os.Setenv(key, "") +}