From 4c0cae7111bd771ff4a19d27fb37ddd2f0aab38d Mon Sep 17 00:00:00 2001 From: Sherlock Holo Date: Wed, 28 Nov 2018 00:08:21 +0800 Subject: [PATCH] Refine runtime.GOOS check, use switch case to replace a long if --- doh-client/main.go | 3 ++- doh-server/main.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doh-client/main.go b/doh-client/main.go index 14a5392..f6a5295 100644 --- a/doh-client/main.go +++ b/doh-client/main.go @@ -79,7 +79,8 @@ func main() { // process tracking. But I understand some cloud service providers have // their own monitoring system. So this feature is only enabled on Linux and // BSD series platforms which lacks functionality similar to cgroup. - if runtime.GOOS == "dragonfly" || runtime.GOOS == "freebsd" || runtime.GOOS == "linux" || runtime.GOOS == "netbsd" || runtime.GOOS == "openbsd" { + switch runtime.GOOS { + case "dragonfly", "freebsd", "linux", "netbsd", "openbsd": pidFile = flag.String("pid-file", "", "PID file for legacy supervision systems lacking support for reliable cgroup-based process tracking") } diff --git a/doh-server/main.go b/doh-server/main.go index fcd8fc2..a6c24e5 100644 --- a/doh-server/main.go +++ b/doh-server/main.go @@ -79,7 +79,8 @@ func main() { // process tracking. But I understand some cloud service providers have // their own monitoring system. So this feature is only enabled on Linux and // BSD series platforms which lacks functionality similar to cgroup. - if runtime.GOOS == "dragonfly" || runtime.GOOS == "freebsd" || runtime.GOOS == "linux" || runtime.GOOS == "netbsd" || runtime.GOOS == "openbsd" { + switch runtime.GOOS { + case "dragonfly", "freebsd", "linux", "netbsd", "openbsd": pidFile = flag.String("pid-file", "", "PID file for legacy supervision systems lacking support for reliable cgroup-based process tracking") }