diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-09-28 12:40:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-28 12:40:17 -0700 |
commit | a8c01377bce777bf1940850e390e587c290e98e0 (patch) | |
tree | 0e176269b5faae110bb402b209d4f192654a435c /vendor/github.com/miekg/dns/generate.go | |
parent | 006623e0f737ca7ee5d482fe47c09048a6f3d06a (diff) | |
download | chat-a8c01377bce777bf1940850e390e587c290e98e0.tar.gz chat-a8c01377bce777bf1940850e390e587c290e98e0.tar.bz2 chat-a8c01377bce777bf1940850e390e587c290e98e0.zip |
Updating server dependancies. (#9498)
Diffstat (limited to 'vendor/github.com/miekg/dns/generate.go')
-rw-r--r-- | vendor/github.com/miekg/dns/generate.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/github.com/miekg/dns/generate.go b/vendor/github.com/miekg/dns/generate.go index e4481a4b0..3a559793f 100644 --- a/vendor/github.com/miekg/dns/generate.go +++ b/vendor/github.com/miekg/dns/generate.go @@ -133,10 +133,20 @@ BuildRR: // Convert a $GENERATE modifier 0,0,d to something Printf can deal with. func modToPrintf(s string) (string, int, error) { - xs := strings.SplitN(s, ",", 3) - if len(xs) != 3 { + xs := strings.Split(s, ",") + + // Modifier is { offset [ ,width [ ,base ] ] } - provide default + // values for optional width and type, if necessary. + switch len(xs) { + case 1: + xs = append(xs, "0", "d") + case 2: + xs = append(xs, "d") + case 3: + default: return "", 0, errors.New("bad modifier in $GENERATE") } + // xs[0] is offset, xs[1] is width, xs[2] is base if xs[2] != "o" && xs[2] != "d" && xs[2] != "x" && xs[2] != "X" { return "", 0, errors.New("bad base in $GENERATE") |