mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
libnetwork/drivers/overlay: fix naked returns, output variables
libnetwork/drivers/overlay/encryption.go:370:2: naked return in func `programSA` with 64 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -304,7 +304,7 @@ func (d *driver) programInput(vni uint32, add bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (fSA *netlink.XfrmState, rSA *netlink.XfrmState, err error) {
|
||||
func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (fSA *netlink.XfrmState, rSA *netlink.XfrmState, lastErr error) {
|
||||
var (
|
||||
action = "Removing"
|
||||
xfrmProgram = ns.NlHandle().XfrmStateDel
|
||||
@@ -330,6 +330,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
|
||||
|
||||
exists, err := saExists(rSA)
|
||||
if err != nil {
|
||||
lastErr = err
|
||||
exists = !add
|
||||
}
|
||||
|
||||
@@ -356,6 +357,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
|
||||
|
||||
exists, err := saExists(fSA)
|
||||
if err != nil {
|
||||
lastErr = err
|
||||
exists = !add
|
||||
}
|
||||
|
||||
@@ -367,7 +369,7 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
return fSA, rSA, lastErr
|
||||
}
|
||||
|
||||
// getMinimalIP returns the address in its shortest form
|
||||
|
||||
Reference in New Issue
Block a user