-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ReplaceNodeContent in persist for transformations #40
Conversation
88cb96e
to
aafed48
Compare
510cf33
to
0d41f48
Compare
53ca792
to
6300d89
Compare
6b1ff6c
to
ec2c865
Compare
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.
Nice — I like how this reduces the boilerplate!
var doTransform func(original *core.SourceFile, modified *core.SourceFile, cap *core.Annotation, result *persistResult, unit *core.ExecutionUnit) (core.CloudResource, error) | ||
var err error | ||
var resource core.CloudResource | ||
var err, runtimeErr, transformErr 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.
minor, but what if we instead had this be a multierr.Error
, and then always appended each err to it (which I think is a noop if the err you're appending is nil?), and then at line 204-210 just checked if the multierr is non-empty? I think that would simplify things, at least to me; fewer vars to think about .
Definitely non-blocking.
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's a good idea, but when I tried it I realized the switch block relies on setting the resource
var (=
not :=
so it doesn't go out of scope) so I'd have to define these errors anyway.
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.
Never change, Go, never change. 🙃
Additionally, on reparse the annotation values are updated instead of replaced leaving the pointer values still valid
expression is now a node and needs .Content
6300d89
to
fb2273c
Compare
|
Utilize the changes in #20 to simplify persist plugin.
Standard checks