From: Bruno Clermont Date: Fri, 10 Feb 2017 08:01:32 +0000 (+0800) Subject: fix copy-paste X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=commitdiff_plain;h=dd971a1f25d6ed025c2feece51f111f06fabae83 fix copy-paste --- 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++ }