You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix staticcheck SA5011 nil pointer dereference in retriever test (#2050)
Combine two separate nil checks into a single condition to eliminate
staticcheck SA5011 warnings about possible nil pointer dereference.
The previous code had two sequential checks:
1. if testGroupName == "" { t.Skip(...) }
2. if group == nil { t.Skip(...) }
Staticcheck couldn't determine that t.Skip() exits the test, so it
flagged the later dereference of group.Servers as potentially unsafe.
By combining these into a single condition (testGroupName == "" ||
group == nil), the linter can clearly see that group cannot be nil
when execution continues past the check.
This maintains the same test behavior while satisfying the linter.
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
0 commit comments