pingcap / pingcap/tidb

add a linter to avoid asserting whether slice is empty (or not) by `arr == nil`.

Open
#52,074 5 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

Ref #51807. It's easy to make mistake that `[]T{} == nil` returns false, so that we'd better to always use `len(arr) > 0` to assert whether a slice is empty. We should also provide an utility to assert whether the slice is really nil.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.