mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-04 03:03:14 -05:00 
			
		
		
		
	Enable intrange linter to enforce modern Go range syntax over traditional for loops, by converting: for i := 0; i < n; i++ to: for i := range n Adding type conversions where needed for compatibility with existing uint64 parameters. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
		
			
				
	
	
		
			28 lines
		
	
	
		
			450 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			450 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package errors
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/coredns/coredns/plugin/test"
 | 
						|
 | 
						|
	"github.com/miekg/dns"
 | 
						|
)
 | 
						|
 | 
						|
func BenchmarkServeDNS(b *testing.B) {
 | 
						|
	h := &errorHandler{}
 | 
						|
	h.Next = test.ErrorHandler()
 | 
						|
 | 
						|
	r := new(dns.Msg)
 | 
						|
	r.SetQuestion("example.org.", dns.TypeA)
 | 
						|
	w := &test.ResponseWriter{}
 | 
						|
	ctx := context.TODO()
 | 
						|
 | 
						|
	for range b.N {
 | 
						|
		_, err := h.ServeDNS(ctx, w, r)
 | 
						|
		if err != nil {
 | 
						|
			b.Errorf("ServeDNS returned error: %s", err)
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 |