-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor of replacement function #1
base: master
Are you sure you want to change the base?
Conversation
if r.Source.MultiRef != nil { | ||
count += 1 | ||
} | ||
// @aodinokov, Should it be equal 1? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should report error when more than 1 contradicting fields are set.
> 1
is right
return s.MultiRef.prepareValue(items) | ||
} | ||
// @aodinokov, Should it be an error? | ||
return "", nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be even panic :)
probably it should be handled in 'validate' function.
and in that case this error will never happen here
return "", nil | ||
} | ||
|
||
func (f Function) Exec(items []*yaml.RNode) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW,
in the last incarnations of plugins I started to call this as Filter function with a bit different signature:
https://github.com/aodinokov/kpt-functions-catalog/blob/function-with-env/functions/go/templater/function/filter.go#L42
this is to match kyaml interface Filter. in that case it's also possilble to use these functions from code inside kyaml filters.
probably something to think about
5ecbce9
to
a029bf0
Compare
646c32f
to
6c6c1ea
Compare
d46169b
to
2f0c1ad
Compare
68c9c67
to
98b8ae6
Compare
0f0197b
to
0e2e126
Compare
a2637ad
to
17cf153
Compare
No description provided.