-
Notifications
You must be signed in to change notification settings - Fork 95
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
refactor: look up default values on struct tag #996
Conversation
dfb341b
to
7d5e839
Compare
m.Mux.RLock() | ||
defer m.Mux.RUnlock() | ||
|
||
return m.AddHostMetadataToTrace | ||
return m.AddHostMetadataToTraceVal, m.AddHostMetadataToTraceErr |
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 we are changing GetAddHostMetadataToTrace()
to use m.AddHostMetadataToTraceVal
as the return value, we will need to assign AddHostMetadataToTraceVal
to true in newStartedApp
in app_test.go
config/mock.go
Outdated
@@ -75,13 +77,17 @@ type MockConfig struct { | |||
DryRun bool | |||
DryRunFieldName string | |||
AddHostMetadataToTrace bool |
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 we choose to use AddHostMetadataToTraceVal
, we probably should delete AddHostMetadataToTrace
.
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.
That's fair. I was trying to limit my changes a bit so I introduced some duplication here, but if I get the build passing I will try to not duplicate these values.
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.
Resolved this with the build fix. Thanks for the help!
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.
Yahoo for fixing the default tag to true issue. I'm not certain that it's a good idea to parse the default tag each time when we try to read the value though. It feels wasted work for me. It would be nice if we could get the default value only once. I think that's maybe what you are working on in a following PR?
I'm thinking maybe it's worth taking the time to see whether using a pointer to represent the three states route works
@VinozzZ Yeah I just spoke with @kentquirk and he agreed that its maybe not the best idea to lookup struct tags for every getter func call. There is an option to cache the struct tag values to maybe make this better. But I think the consensus here is that using a |
Which problem is this PR solving?
Short description of the changes