prow/genfiles/genfiles.go
func (g *Group) load(r io.Reader) ([]string, error) {
	var repoPaths []string
	s := bufio.NewScanner(r)
	for s.Scan() {
		l := strings.TrimSpace(s.Text())
		if l == "" || l[0] == '#' {
			// Ignore comments and empty lines.
			continue
		}

		fs := strings.Fields(l)
		if len(fs) != 2 {
			return repoPaths, &ParseError{line: l}
		}

		switch fs[0] {
		case "prefix", "path-prefix":
			g.PathPrefixes[fs[1]] = true
		case "file-prefix":
			g.FilePrefixes[fs[1]] = true
		case "file-name":
			g.FileNames[fs[1]] = true
		case "path":
			g.FileNames[fs[1]] = true
		case "paths-from-repo":
			// Despite the name, this command actually requires a file
			// of paths from the _same_ repo in which the .generated_files
			// config lives.
			repoPaths = append(repoPaths, fs[1])
		default:
			return repoPaths, &ParseError{line: l}
		}
	}

	if err := s.Err(); err != nil {
		return repoPaths, err
	}

	return repoPaths, nil
}
func (g *Group) load(r io.Reader) ([]string, error) {
	var repoPaths []string
	s := bufio.NewScanner(r)
	for s.Scan() {
		l := strings.TrimSpace(s.Text())
		if l == "" || l[0] == '#' {
			// Ignore comments and empty lines.
			continue
		}

		fs := strings.Fields(l)
		if len(fs) != 2 {
			return repoPaths, &ParseError{line: l}
		}

		switch fs[0] {
		case "prefix", "path-prefix":
			g.PathPrefixes[fs[1]] = true
		case "file-prefix":
			g.FilePrefixes[fs[1]] = true
		case "file-name":
			g.FileNames[fs[1]] = true
		case "path":
			g.FileNames[fs[1]] = true
		case "paths-from-repo":
			// Despite the name, this command actually requires a file
			// of paths from the _same_ repo in which the .generated_files
			// config lives.
			repoPaths = append(repoPaths, fs[1])
		default:
			return repoPaths, &ParseError{line: l}
		}
	}

	if err := s.Err(); err != nil {
		return repoPaths, err
	}

	return repoPaths, nil
}
// Use load to read a generated files config file, and populate g with the commands.
// "paths-from-repo" commands are aggregated into repoPaths. It is the caller's
// responsibility to fetch these and load them via g.loadPaths.