Skip to content

Commit

Permalink
Update PrefixesSuffixesEquals function
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlking committed Mar 6, 2024
1 parent 12ad89b commit 534ac51
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/resource/resource.go
Expand Up @@ -291,8 +291,11 @@ func (r *Resource) getCsvAnnotation(name string) []string {
// as OutermostPrefixSuffix but performs a deeper comparison
// of the suffix and prefix slices.
func (r *Resource) PrefixesSuffixesEquals(o ResCtx) bool {
return utils.SameEndingSubSlice(r.GetNamePrefixes(), o.GetNamePrefixes()) &&
utils.SameEndingSubSlice(r.GetNameSuffixes(), o.GetNameSuffixes())
eitherPrefixEmpty := len(r.GetNamePrefixes()) == 0 || len(o.GetNamePrefixes()) == 0
eitherSuffixEmpty := len(r.GetNameSuffixes()) == 0 || len(o.GetNameSuffixes()) == 0

return (eitherPrefixEmpty || utils.SameEndingSubSlice(r.GetNamePrefixes(), o.GetNamePrefixes())) &&
(eitherSuffixEmpty || utils.SameEndingSubSlice(r.GetNameSuffixes(), o.GetNameSuffixes()))
}

// RemoveBuildAnnotations removes annotations created by the build process.
Expand Down

0 comments on commit 534ac51

Please sign in to comment.