Skip to content

Commit

Permalink
Fix duplicate definition of predicate (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjumani authored Sep 19, 2024
1 parent ee1f4c6 commit dc4646f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 6 additions & 0 deletions changelog/v0.35.4/fix-duplicate-predicate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/gloo/issues/9274
resolvesIssue: false
description: Fixes the issue of multiple declarations of Predicate when multiple snapshots are generated

2 changes: 2 additions & 0 deletions pkg/api/v1/resources/core/metadata_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ func (m *Metadata) Ref() *ResourceRef {
func (m *Metadata) Match(ref *ResourceRef) bool {
return m.GetNamespace() == ref.GetNamespace() && m.GetName() == ref.GetName()
}

type Predicate func(metadata *Metadata) bool
4 changes: 1 addition & 3 deletions pkg/code-generator/codegen/templates/snapshot_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ func (s *{{ .GoName }}Snapshot) RemoveFromResourceList(resource resources.Resour
}
}
type Predicate func(metadata *core.Metadata) bool
func (s *{{ .GoName }}Snapshot) RemoveMatches(predicate Predicate) {
func (s *{{ .GoName }}Snapshot) RemoveMatches(predicate core.Predicate) {
{{- range .Resources }}
var {{ upper_camel .PluralName }} {{ .ImportPrefix }}{{ .Name }}List
for _, res := range s.{{ upper_camel .PluralName }} {
Expand Down
4 changes: 1 addition & 3 deletions test/mocks/v1/testing_snapshot.sk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions test/mocks/v1alpha1/testing_snapshot.sk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions test/mocks/v2alpha1/testing_snapshot.sk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc4646f

Please sign in to comment.