code: func openSourceFile(path, searchPath, trim string) (*os.File, error) {
  	path = trimPath(path, trim, searchPath)
  	// If file is still absolute, require file to exist.
  	if filepath.IsAbs(path) {
  		f, err := os.Open(path)
  		return f, err
  	}
  	// Scan each component of the path.
  	for _, dir := range filepath.SplitList(searchPath) {
  		// Search up for every parent of each possible path.
  		for {
  			filename := filepath.Join(dir, path)
  			if f, err := os.Open(filename); err == nil {
  				return f, nil
  			}
  			parent := filepath.Dir(dir)
  			if parent == dir {
  				break
  			}
  			dir = parent
  		}
  	}
  
  	return nil, fmt.Errorf("could not find file %s on path %s", path, searchPath)
  }
docs: // openSourceFile opens a source file from a name encoded in a profile. File
  // names in a profile after can be relative paths, so search them in each of
  // the paths in searchPath and their parents. In case the profile contains
  // absolute paths, additional paths may be configured to trim from the source
  // paths in the profile. This effectively turns the path into a relative path
  // searching it using searchPath as usual).