func()

in pkg/repo/repo.go [205:255]


func (r *Repo) findLocalKEPMeta(sig string) ([]string, error) {
	sigPath := filepath.Join(r.ProposalPath, sig)

	keps := []string{}

	// if the SIG doesn't have a dir, it has no KEPs
	if _, err := os.Stat(sigPath); os.IsNotExist(err) {
		return keps, nil
	}

	err := filepath.Walk(
		sigPath,
		func(path string, info os.FileInfo, err error) error {
			logrus.Debugf("processing filename %s", info.Name())

			if err != nil {
				return err
			}

			// true if the file is a symlink
			if info.Mode()&os.ModeSymlink != 0 {
				// Assume symlink from old KEP location to new. The new location
				// will be processed separately, so no need to process it here.
				logrus.Debugf("%s is a symlink", info.Name())
				return nil
			}

			if !info.Mode().IsRegular() {
				return nil
			}

			if info.Name() == ProposalMetadataFilename {
				logrus.Debugf("adding %s as KEP metadata", info.Name())
				path, err = filepath.Rel(r.BasePath, path)
				if err != nil {
					return err
				}
				keps = append(keps, path)
				return filepath.SkipDir
			}

			if info.Name() == ProposalFilename {
				return nil
			}

			return nil
		},
	)

	return keps, err
}