From d13ba02ef07b4ea5852bd8143324504965d5b01f Mon Sep 17 00:00:00 2001 From: Kent 'picat' Gruber Date: Fri, 31 May 2019 13:13:06 -0400 Subject: [PATCH 1/2] Update host_darwin.go The /System/Library/CoreServices/ServerVersion.plist exists on macOS servers , but not on a workstation such as my laptop. The actual terminoly is mostly borrowed from the windows equivalent as @Lomanic suggested. In theory, this should make interpreting the results from the two platforms a bit more consistent. Note: The macOS server application can be installed on almost any macOS workstation to make it a server that can manage other apple devices. --- host/host_darwin.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/host/host_darwin.go b/host/host_darwin.go index 9f2b6b4..f42e691 100644 --- a/host/host_darwin.go +++ b/host/host_darwin.go @@ -189,6 +189,16 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string pver = strings.ToLower(strings.TrimSpace(string(out))) } + // check if the macos server version file exists + _, err := os.Stat("/System/Library/CoreServices/ServerVersion.plist") + + // server file doesn't exist + if os.IsNotExist(err) { + family = "Standalone Workstation" + } else { + family = "Server" + } + return platform, family, pver, nil } From e507f44421592eca2227e93a1d04c391e9896a45 Mon Sep 17 00:00:00 2001 From: Kent 'picat' Gruber Date: Fri, 31 May 2019 13:19:04 -0400 Subject: [PATCH 2/2] Update host_darwin.go Copy+pasta got me again! :spaghetti: No new variable on the left of `:=` :joy: --- host/host_darwin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/host_darwin.go b/host/host_darwin.go index f42e691..de8277f 100644 --- a/host/host_darwin.go +++ b/host/host_darwin.go @@ -190,7 +190,7 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string } // check if the macos server version file exists - _, err := os.Stat("/System/Library/CoreServices/ServerVersion.plist") + _, err = os.Stat("/System/Library/CoreServices/ServerVersion.plist") // server file doesn't exist if os.IsNotExist(err) {