code: func ValidateContextDirectory(srcPath string, excludes []string) error {
  	contextRoot, err := getContextRoot(srcPath)
  	if err != nil {
  		return err
  	}
  
  	pm, err := fileutils.NewPatternMatcher(excludes)
  	if err != nil {
  		return err
  	}
  
  	return filepath.Walk(contextRoot, func(filePath string, f os.FileInfo, err error) error {
  		if err != nil {
  			if os.IsPermission(err) {
  				return errors.Errorf("can't stat '%s'", filePath)
  			}
  			if os.IsNotExist(err) {
  				return errors.Errorf("file ('%s') not found or excluded by .dockerignore", filePath)
  			}
  			return err
  		}
  
  		// skip this directory/file if it's not in the path, it won't get added to the context
  		if relFilePath, err := filepath.Rel(contextRoot, filePath); err != nil {
  			return err
  		} else if skip, err := filepathMatches(pm, relFilePath); err != nil {
  			return err
  		} else if skip {
  			if f.IsDir() {
  				return filepath.SkipDir
  			}
  			return nil
  		}
  
  		// skip checking if symlinks point to non-existing files, such symlinks can be useful
  		// also skip named pipes, because they hanging on open
  		if f.Mode()&(os.ModeSymlink|os.ModeNamedPipe) != 0 {
  			return nil
  		}
  
  		if !f.IsDir() {
  			currentFile, err := os.Open(filePath)
  			if err != nil && os.IsPermission(err) {
  				return errors.Errorf("no permission to read from '%s'", filePath)
  			}
  			currentFile.Close()
  		}
  		return nil
  	})
  }
docs: // ValidateContextDirectory checks if all the contents of the directory
  // can be read and returns an error if some files can't be read
  // symlinks which point to non-existing files don't trigger an error