a3c97beee0
Implement a function that returns an error to replace existing uses of the IsOSSupported utility, where callers had to produce the error after checking. The IsOSSupported function was used in combination with images, so implementing a utility in "image" to prevent having to import pkg/system (which contains many unrelated functions) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
19 lines
571 B
Go
19 lines
571 B
Go
package system
|
|
|
|
import (
|
|
"errors"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// ErrNotSupportedOperatingSystem means the operating system is not supported.
|
|
//
|
|
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
|
|
var ErrNotSupportedOperatingSystem = errors.New("operating system is not supported")
|
|
|
|
// IsOSSupported determines if an operating system is supported by the host.
|
|
//
|
|
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
|
|
func IsOSSupported(os string) bool {
|
|
return strings.EqualFold(runtime.GOOS, os)
|
|
}
|