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
+2
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user