]> Cypherpunks.ru repositories - govpn.git/commitdiff
fix copy-paste
authorBruno Clermont <bruno@robotinfra.com>
Fri, 10 Feb 2017 08:01:32 +0000 (16:01 +0800)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 3 Mar 2017 21:10:21 +0000 (00:10 +0300)
src/cypherpunks.ru/govpn/common.go

index 684491cfd950516aab0ad412bba1932f84293c36..40674623fab86ed4790d3c2da54e36d227a1b0c9 100644 (file)
@@ -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++
        }