-
Notifications
You must be signed in to change notification settings - Fork 6.5k
chore(lint): enable typeSwitchVar linter #23391
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
chore(lint): enable typeSwitchVar linter #23391
Conversation
Signed-off-by: Michael Crenshaw <[email protected]>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
| switch segment := segment.(type) { | ||
| case int: | ||
| i = i.([]any)[segment.(int)] | ||
| i = i.([]any)[segment] | ||
| case string: | ||
| i = i.(map[string]any)[segment.(string)] | ||
| i = i.(map[string]any)[segment] |
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 three lines are what the linter required.
| } | ||
|
|
||
| func dig[T any](obj any, path []any) T { | ||
| func dig(obj any, path ...any) any { |
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.
Got rid of generics (not needed) and replaced slice w/ nicer alternative.
Signed-off-by: Michael Crenshaw <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #23391 +/- ##
==========================================
- Coverage 60.10% 60.05% -0.06%
==========================================
Files 342 342
Lines 58820 58820
==========================================
- Hits 35353 35323 -30
- Misses 20623 20641 +18
- Partials 2844 2856 +12 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Michael Crenshaw <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]> Signed-off-by: Jonathan Ogilvie <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]> Signed-off-by: enneitex <[email protected]>
I took the liberty of simplifying the dig function even more than required to fix the lint.