-
Notifications
You must be signed in to change notification settings - Fork 40
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
return nil instead of empty map #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -168,12 +168,11 @@ func (p *persister) handleFile(f *core.SourceFile, unit *core.ExecutionUnit) ([] | |||||
continue | ||||||
} | ||||||
|
||||||
if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { | ||||||
continue | ||||||
} | ||||||
|
||||||
keyType, pResult := p.determinePersistType(f, annot) | ||||||
if pResult == nil { | ||||||
if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This will work for both nil and empty. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it doesnt let you do len on that object There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yeah you'd have to |
||||||
continue | ||||||
} | ||||||
log.Warn("Could not determine persist type") | ||||||
continue | ||||||
} | ||||||
|
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.
The following line should also be
nil
, right?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.
if it exists but theres nothing in the map, then we should likely keep it? I pushed this already but can make changes if we need
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.
the other question is does anything outside of env vars use this today?
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.
This
if !ok
on the type assertion would mean that e.g.environment_variable = 10
- that it's not a table. IMO it should be treated the same as if it weren't set.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.
yeah that maybe we would want to error and say that its set to an incorrect type even, should i add a card for this? I dont think weve really touched the logic of directives too much. Were unblocked for now but youre right we may want to add more to this