-
Notifications
You must be signed in to change notification settings - Fork 348
chore: Enable protogetter linter and run fixes #2638
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
base: main
Are you sure you want to change the base?
Conversation
30f414d to
c149d58
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2638 +/- ##
==========================================
+ Coverage 79.14% 79.14% +0.01%
==========================================
Files 452 452
Lines 46401 46404 +3
==========================================
+ Hits 36719 36723 +4
+ Misses 6923 6921 -2
- Partials 2759 2760 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c149d58 to
e825f57
Compare
e825f57 to
3008292
Compare
3008292 to
45d4100
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.
These are the only two files that I touched manually
| return *written.Counter.Value | ||
| counter := written.GetCounter() | ||
| if counter == nil { | ||
| panic("counter was nil") | ||
| } | ||
| return counter.GetValue() |
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 is a meaningful change - we were actually depending on this to panic if Counter was nil, so the nil-safety fix kinda broke the functionality.
| if result != 0.0 { | ||
| t.Errorf("Initial counter value should be 0.0, got %v", result) | ||
| } | ||
| require.Equal(t, 0.0, result, "Initial counter value should be 0.0") |
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.
Refactoring these tests to use require to bring them in line with the rest of the codebase.
Fixes #2633
Part of #2579
Description
If you have a deeply nested proto object, calling
a.GetSet().GetOf().GetGetters()is safer than referencingsome.Chain.Of.Properties, because the first will returnnilif there's a nil in the chain, where the second will panic.protogetterlints for this and should help address #2579.Changes
Testing
Review. See that tests pass.