1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix getting the operating system on Darwin

This used to return "Darwin\n", but now returns "Darwin"

Signed-off-by: Simon Barendse <simon.barendse@gmail.com>
This commit is contained in:
Simon Barendse 2019-08-29 16:58:38 +02:00
parent 7ce0e26c16
commit ea65f0bca2
No known key found for this signature in database
GPG key ID: EC60DC2967B22C7F

View file

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os/exec" "os/exec"
"strings"
) )
// GetOperatingSystem gets the name of the current operating system. // GetOperatingSystem gets the name of the current operating system.
@ -15,7 +16,7 @@ func GetOperatingSystem() (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
return string(osName), nil return strings.TrimSpace(string(osName)), nil
} }
// GetOperatingSystemVersion gets the version of the current operating system, as a string. // GetOperatingSystemVersion gets the version of the current operating system, as a string.