From dd971a1f25d6ed025c2feece51f111f06fabae83 Mon Sep 17 00:00:00 2001 From: Bruno Clermont Date: Fri, 10 Feb 2017 16:01:32 +0800 Subject: [PATCH] fix copy-paste --- src/cypherpunks.ru/govpn/common.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/cypherpunks.ru/govpn/common.go b/src/cypherpunks.ru/govpn/common.go index 684491c..4067462 100644 --- a/src/cypherpunks.ru/govpn/common.go +++ b/src/cypherpunks.ru/govpn/common.go @@ -121,8 +121,12 @@ func (p *Protocol) UnmarshalYAML(unmarshal func(interface{}) error) error { // NewProtocolFromString converts a string into a govpn.Protocol func NewProtocolFromString(p string) (Protocol, error) { - lowP := strings.ToLower(p) - for k, v := range protocolText { + var ( + k Protocol + v string + lowP = strings.ToLower(p) + ) + for k, v = range protocolText { if strings.ToLower(v) == lowP { return k, nil } @@ -130,13 +134,8 @@ func NewProtocolFromString(p string) (Protocol, error) { choices := make([]string, len(protocolText)) var index = 0 - for k, v := range protocolText { - if v == p { - z := k - p = &z - return nil - } - choices[index] = v + for k = range protocolText { + choices[index] = protocolText[k] index++ } -- 2.44.0