code: func ValidateLayout(dir string) error {
  	fi, err := os.Stat(dir)
  	if err != nil {
  		return fmt.Errorf("error accessing layout: %v", err)
  	}
  	if !fi.IsDir() {
  		return fmt.Errorf("given path %q is not a directory", dir)
  	}
  	var flist []string
  	var imOK, rfsOK bool
  	var im io.Reader
  	walkLayout := func(fpath string, fi os.FileInfo, err error) error {
  		rpath, err := filepath.Rel(dir, fpath)
  		if err != nil {
  			return err
  		}
  		switch rpath {
  		case ".":
  		case ManifestFile:
  			im, err = os.Open(fpath)
  			if err != nil {
  				return err
  			}
  			imOK = true
  		case RootfsDir:
  			if !fi.IsDir() {
  				return errors.New("rootfs is not a directory")
  			}
  			rfsOK = true
  		default:
  			flist = append(flist, rpath)
  		}
  		return nil
  	}
  	if err := filepath.Walk(dir, walkLayout); err != nil {
  		return err
  	}
  	return validate(imOK, im, rfsOK, flist)
  }
docs: // ValidateLayout takes a directory and validates that the layout of the directory
  // matches that expected by the Application Container Image format.
  // If any errors are encountered during the validation, it will abort and
  // return the first one.