Skip to content

Commit

Permalink
Drop strvals use strings.Split
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Nov 30, 2021
1 parent a8a0c29 commit 5c14dae
Show file tree
Hide file tree
Showing 30 changed files with 13 additions and 11,585 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
github.com/jhump/protoreflect v1.10.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/klauspost/compress v1.13.6
github.com/kubernetes/helm v2.9.0+incompatible
github.com/mailru/easyjson v0.7.7
github.com/manyminds/api2go v0.0.0-20180125085803-95be7bd0455e
github.com/mattn/go-colorable v0.1.8
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ=
github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813/go.mod h1:P+oSoE9yhSRvsmYyZsshflcR6ePWYLql6UU1amW13IM=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
Expand Down Expand Up @@ -176,8 +175,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubernetes/helm v2.9.0+incompatible h1:X6Tl40RMiqT0GD8hT3+jFPgkZV1EB6vYsoJDX8YkY+c=
github.com/kubernetes/helm v2.9.0+incompatible/go.mod h1:3Nb8I82ptmDi7OvvBQK25X1bwxg+WMAkusUQXHxu8ag=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
Expand Down
22 changes: 13 additions & 9 deletions lib/types/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"bytes"
"encoding/json"
"fmt"
"strings"

"github.com/kubernetes/helm/pkg/strvals"
"gopkg.in/guregu/null.v3"
)

Expand Down Expand Up @@ -213,33 +213,37 @@ func (c *DNSConfig) UnmarshalText(text []byte) error {
*c = DefaultDNSConfig()
return nil
}
params, err := strvals.Parse(string(text))
if err != nil {
return err
values := strings.Split(string(text), ",")
params := make(map[string]string, len(values))
for _, value := range values {
args := strings.SplitN(value, "=", 2)
if len(args) != 2 {
return fmt.Errorf("no value for key %s", value)
}
params[args[0]] = args[1]
}
return c.unmarshal(params)
}

func (c *DNSConfig) unmarshal(params map[string]interface{}) error {
func (c *DNSConfig) unmarshal(params map[string]string) error {
for k, v := range params {
switch k {
case "policy":
p, err := DNSPolicyString(v.(string))
p, err := DNSPolicyString(v)
if err != nil {
return err
}
c.Policy.DNSPolicy = p
c.Policy.Valid = true
case "select":
s, err := DNSSelectString(v.(string))
s, err := DNSSelectString(v)
if err != nil {
return err
}
c.Select.DNSSelect = s
c.Select.Valid = true
case "ttl":
ttlv := fmt.Sprintf("%v", v)
c.TTL = null.StringFrom(ttlv)
c.TTL = null.StringFrom(v)
default:
return fmt.Errorf("unknown DNS configuration field: %s", k)
}
Expand Down
20 changes: 0 additions & 20 deletions vendor/github.com/ghodss/yaml/.gitignore

This file was deleted.

50 changes: 0 additions & 50 deletions vendor/github.com/ghodss/yaml/LICENSE

This file was deleted.

121 changes: 0 additions & 121 deletions vendor/github.com/ghodss/yaml/README.md

This file was deleted.

Loading

0 comments on commit 5c14dae

Please sign in to comment.