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
@@ -15,7 +15,8 @@ func GetLans() ([]*net.IPNet, error) {
if err != nil {
return nil, err
}
addrs := []net.Addr{}
var addrs []net.Addr
for _, currentIf := range ifs {
if currentIf.Flags&net.FlagUp != net.FlagUp {
continue