diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-15 09:19:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 09:19:40 -0400 |
commit | f4c3b718eb22a161a897a6ed55d10f3a07e31aa8 (patch) | |
tree | bb453d40a50f8cef1ebfedc73e43e2c7fe7d3456 /pkg/network/network.go | |
parent | e94e3fd2e829fd2cd38428aa9d9bf68b37bb8407 (diff) | |
parent | 200cfa41a434b7143620c2c252b3eb7ab3ef92f9 (diff) | |
download | podman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.tar.gz podman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.tar.bz2 podman-f4c3b718eb22a161a897a6ed55d10f3a07e31aa8.zip |
Merge pull request #6557 from rhatdan/lint
Turn on More linters
Diffstat (limited to 'pkg/network/network.go')
-rw-r--r-- | pkg/network/network.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/network/network.go b/pkg/network/network.go index 3ff664316..997aaf8a2 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -30,11 +30,11 @@ func IsSupportedDriver(driver string) error { // GetLiveNetworks returns a slice of networks representing what the system // has defined as network interfaces func GetLiveNetworks() ([]*net.IPNet, error) { - var nets []*net.IPNet addrs, err := net.InterfaceAddrs() if err != nil { return nil, err } + nets := make([]*net.IPNet, 0, len(addrs)) for _, address := range addrs { _, n, err := net.ParseCIDR(address.String()) if err != nil { @@ -47,11 +47,11 @@ func GetLiveNetworks() ([]*net.IPNet, error) { // GetLiveNetworkNames returns a list of network interfaces on the system func GetLiveNetworkNames() ([]string, error) { - var interfaceNames []string liveInterfaces, err := net.Interfaces() if err != nil { return nil, err } + interfaceNames := make([]string, 0, len(liveInterfaces)) for _, i := range liveInterfaces { interfaceNames = append(interfaceNames, i.Name) } |