all: replace empty slice literal with var (#8990)
refactor: replace empty slice literal with `var` An empty slice can be represented by `nil` or an empty slice literal. They are functionally equivalent — their `len` and `cap` are both zero — but the `nil` slice is the preferred style. For more information about empty slices, see [Declaring Empty Slices](https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices). Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
parent
f23c41221b
commit
21c074cc2c
@@ -32,7 +32,8 @@ func (t emptyDirTracker) addFile(path string) {
|
||||
}
|
||||
|
||||
func (t emptyDirTracker) emptyDirs() []string {
|
||||
empty := []string{}
|
||||
var empty []string
|
||||
|
||||
for dir := range t {
|
||||
empty = append(empty, dir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user