From b7229667dee1fc51c268df3846b7c1b986185d2c Mon Sep 17 00:00:00 2001 From: Daniel Theophanes Date: Fri, 1 May 2015 12:16:19 -0700 Subject: [PATCH] service: make System.String() consistent. Fixes #15 --- service_darwin.go | 2 +- service_linux.go | 21 +++------------------ service_windows.go | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/service_darwin.go b/service_darwin.go index 5f427a5..0560b29 100644 --- a/service_darwin.go +++ b/service_darwin.go @@ -16,7 +16,7 @@ import ( const maxPathSize = 32 * 1024 -const version = "Darwin Launchd" +const version = "darwin-launchd" type darwinSystem struct{} diff --git a/service_linux.go b/service_linux.go index 1a832b7..9341c06 100644 --- a/service_linux.go +++ b/service_linux.go @@ -5,25 +5,10 @@ package service import ( - "fmt" "os" "strings" ) -type linuxSystem struct { - interactive bool - selectedName string - selectedNew func(i Interface, c *Config) (Service, error) -} - -func (ls linuxSystem) String() string { - return fmt.Sprintf("Linux %s", ls.selectedName) -} - -func (ls linuxSystem) Interactive() bool { - return ls.interactive -} - type linuxSystemService struct { name string detect func() bool @@ -46,7 +31,7 @@ func (sc linuxSystemService) New(i Interface, c *Config) (Service, error) { func init() { ChooseSystem(linuxSystemService{ - name: "systemd", + name: "linux-systemd", detect: isSystemd, interactive: func() bool { is, _ := isInteractive() @@ -55,7 +40,7 @@ func init() { new: newSystemdService, }, linuxSystemService{ - name: "Upstart", + name: "linux-upstart", detect: isUpstart, interactive: func() bool { is, _ := isInteractive() @@ -64,7 +49,7 @@ func init() { new: newUpstartService, }, linuxSystemService{ - name: "System-V", + name: "unix-systemv", detect: func() bool { return true }, interactive: func() bool { is, _ := isInteractive() diff --git a/service_windows.go b/service_windows.go index 3544ebf..3fd9eb9 100644 --- a/service_windows.go +++ b/service_windows.go @@ -16,7 +16,7 @@ import ( "golang.org/x/sys/windows/svc/mgr" ) -const version = "Windows Service" +const version = "windows-service" type windowsService struct { i Interface