Allow gorepomod to update plugin mod files

This commit is contained in:
Katrina Verey
2023-02-02 11:33:46 -05:00
parent 4fff8399ea
commit 8b51c295a1
2 changed files with 4 additions and 4 deletions

View File

@@ -36,7 +36,6 @@ var (
"docs",
"examples",
"hack",
"plugin",
"releasing",
"site",
}

View File

@@ -45,8 +45,9 @@ func (dg *DotGitData) AbsPath() string {
// NewDotGitDataFromPath wants the incoming path to hold dotGit
// E.g.
// ~/gopath/src/sigs.k8s.io/kustomize
// ~/gopath/src/github.com/monopole/gorepomod
//
// ~/gopath/src/sigs.k8s.io/kustomize
// ~/gopath/src/github.com/monopole/gorepomod
func NewDotGitDataFromPath(path string) (*DotGitData, error) {
if !utils.DirExists(filepath.Join(path, dotGitFileName)) {
return nil, fmt.Errorf(
@@ -126,7 +127,7 @@ func (dg *DotGitData) checkModules(modules []*protoModule) error {
}
} else {
// Do the relative path and short name make sense?
if !strings.HasSuffix(pm.PathToGoMod(), string(shortName)) {
if !strings.HasPrefix(string(shortName), "plugin/") && !strings.HasSuffix(pm.PathToGoMod(), string(shortName)) {
return fmt.Errorf(
"in %q, the module name %q doesn't match the file's pathToGoMod %q",
file, shortName, pm.PathToGoMod())