diff options
author | 2018-09-22 15:12:02 +0100 | |
---|---|---|
committer | 2018-09-22 15:12:02 +0100 | |
commit | 9546b606cb58a372361b39604c1ccf54ed91c7b9 (patch) | |
tree | dd218e883da9d27e34a76dc75407bccb3b32c938 /plugin/pkg/dnsutil/join.go | |
parent | b3d69f1c7f226805e7f70cfd0e88b488dc2eab1b (diff) | |
download | coredns-9546b606cb58a372361b39604c1ccf54ed91c7b9.tar.gz coredns-9546b606cb58a372361b39604c1ccf54ed91c7b9.tar.zst coredns-9546b606cb58a372361b39604c1ccf54ed91c7b9.zip |
K8s remove string ops (#2119)
* plugin/kubernetes: remove bunch a string ops
This removes a bunch of appends to where not needed, makes dnsutil.Join
take variadic args which removes the need to wrap in a new string slice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix calls to dnsutil.Join
Signed-off-by: Miek Gieben <miek@miek.nl>
* Revert these
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/pkg/dnsutil/join.go')
-rw-r--r-- | plugin/pkg/dnsutil/join.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/plugin/pkg/dnsutil/join.go b/plugin/pkg/dnsutil/join.go index 515bf3dad..b3a40db42 100644 --- a/plugin/pkg/dnsutil/join.go +++ b/plugin/pkg/dnsutil/join.go @@ -8,12 +8,10 @@ import ( // Join joins labels to form a fully qualified domain name. If the last label is // the root label it is ignored. Not other syntax checks are performed. -func Join(labels []string) string { +func Join(labels ...string) string { ll := len(labels) if labels[ll-1] == "." { - s := strings.Join(labels[:ll-1], ".") - return dns.Fqdn(s) + return strings.Join(labels[:ll-1], ".") + "." } - s := strings.Join(labels, ".") - return dns.Fqdn(s) + return dns.Fqdn(strings.Join(labels, ".")) } |