mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 09:02:53 +00:00
In module lists, handle allowed replacements.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"golang.org/x/mod/modfile"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/semver"
|
||||
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/utils"
|
||||
)
|
||||
|
||||
// Module is an immutable representation of a Go module.
|
||||
@@ -77,3 +78,14 @@ func (m *Module) GetReplacements() (result []string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *Module) GetDisallowedReplacements(
|
||||
allowedReplacements []string) (badReps []string) {
|
||||
for _, r := range m.GetReplacements() {
|
||||
m := utils.ExtractModule(r)
|
||||
if !utils.SliceContains(allowedReplacements, m) {
|
||||
badReps = append(badReps, r)
|
||||
}
|
||||
}
|
||||
return badReps
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user