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:
deepsource-autofix[bot]
2023-07-18 14:44:37 +00:00
committed by GitHub
co-authored by deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
parent f23c41221b
commit 21c074cc2c
4 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -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)
}