image_os.go 369 B

123456789101112131415161718
  1. package image
  2. import (
  3. "errors"
  4. "runtime"
  5. "strings"
  6. "github.com/docker/docker/errdefs"
  7. )
  8. // CheckOS checks if the given OS matches the host's platform, and
  9. // returns an error otherwise.
  10. func CheckOS(os string) error {
  11. if !strings.EqualFold(runtime.GOOS, os) {
  12. return errdefs.InvalidParameter(errors.New("operating system is not supported"))
  13. }
  14. return nil
  15. }