github.com/toplink-cn/moby@v0.0.0-20240305205811-460b4aebdf81/image/image_os.go (about)

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