mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 02:33:21 -05:00 
			
		
		
		
	* 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>
		
			
				
	
	
		
			18 lines
		
	
	
		
			397 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			397 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dnsutil
 | 
						|
 | 
						|
import (
 | 
						|
	"strings"
 | 
						|
 | 
						|
	"github.com/miekg/dns"
 | 
						|
)
 | 
						|
 | 
						|
// 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 {
 | 
						|
	ll := len(labels)
 | 
						|
	if labels[ll-1] == "." {
 | 
						|
		return strings.Join(labels[:ll-1], ".") + "."
 | 
						|
	}
 | 
						|
	return dns.Fqdn(strings.Join(labels, "."))
 | 
						|
}
 |