Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Refactor of replacement function #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Refactor of replacement function #1

wants to merge 2 commits into from

Conversation

aepifanov
Copy link

No description provided.

if r.Source.MultiRef != nil {
count += 1
}
// @aodinokov, Should it be equal 1?
Copy link
Owner

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
Copy link
Owner

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 {
Copy link
Owner

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

@aodinokov aodinokov force-pushed the master branch 25 times, most recently from 5ecbce9 to a029bf0 Compare October 2, 2020 07:04
@aodinokov aodinokov force-pushed the master branch 9 times, most recently from 646c32f to 6c6c1ea Compare October 21, 2020 02:10
@aodinokov aodinokov force-pushed the master branch 3 times, most recently from d46169b to 2f0c1ad Compare December 5, 2020 04:08
@aodinokov aodinokov force-pushed the master branch 11 times, most recently from 68c9c67 to 98b8ae6 Compare March 14, 2021 05:17
@aodinokov aodinokov force-pushed the master branch 2 times, most recently from 0f0197b to 0e2e126 Compare April 15, 2021 04:30
@aodinokov aodinokov force-pushed the master branch 2 times, most recently from a2637ad to 17cf153 Compare June 16, 2021 17:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants