all: use any instead of interface{}

My favorite part of generics.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder
2022-03-16 16:27:57 -07:00
committed by Josh Bleecher Snyder
parent 5f176f24db
commit 0868329936
88 changed files with 204 additions and 204 deletions
+1 -1
View File
@@ -711,7 +711,7 @@ type response struct {
}
var dnsParserPool = &sync.Pool{
New: func() interface{} {
New: func() any {
return new(dnsParser)
},
}
+2 -2
View File
@@ -221,7 +221,7 @@ func weirdoGoCNAMEHandler(target string) dns.HandlerFunc {
// provided.
//
// Types supported: netaddr.IP.
func dnsHandler(answers ...interface{}) dns.HandlerFunc {
func dnsHandler(answers ...any) dns.HandlerFunc {
return func(w dns.ResponseWriter, req *dns.Msg) {
m := new(dns.Msg)
m.SetReply(req)
@@ -303,7 +303,7 @@ func dnsHandler(answers ...interface{}) dns.HandlerFunc {
}
}
func serveDNS(tb testing.TB, addr string, records ...interface{}) *dns.Server {
func serveDNS(tb testing.TB, addr string, records ...any) *dns.Server {
if len(records)%2 != 0 {
panic("must have an even number of record values")
}
+2 -2
View File
@@ -454,7 +454,7 @@ func TestDelegate(t *testing.T) {
// intend to handle responses this large, so there should be truncation.
hugeTXT := generateTXT(64000, randSource)
records := []interface{}{
records := []any{
"test.site.",
resolveToIP(testipv4, testipv6, "dns.test.site."),
"LCtesT.SiTe.",
@@ -1105,7 +1105,7 @@ func TestHandleExitNodeDNSQueryWithNetPkg(t *testing.T) {
t.Skip("skipping test on Windows; waiting for golang.org/issue/33097")
}
records := []interface{}{
records := []any{
"no-records.test.",
dnsHandler(),