types/ptr: deprecate ptr.To, use Go 1.26 new

Updates #18682

Change-Id: I62f6aa0de2a15ef8c1435032c6aa74a181c25f8f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-03-05 22:48:46 +00:00
committed by Brad Fitzpatrick
parent 8cfbaa717d
commit 2a64c03c95
96 changed files with 429 additions and 532 deletions
+4 -5
View File
@@ -24,7 +24,6 @@ import (
"go4.org/netipx"
"tailscale.com/tailcfg"
"tailscale.com/types/key"
"tailscale.com/types/ptr"
"tailscale.com/util/deephash/testtype"
"tailscale.com/util/hashx"
"tailscale.com/version"
@@ -382,7 +381,7 @@ func TestGetTypeHasher(t *testing.T) {
},
{
name: "time_ptr", // addressable, as opposed to "time" test above
val: ptr.To(time.Unix(1234, 5678).In(time.UTC)),
val: new(time.Unix(1234, 5678).In(time.UTC)),
out: u8(1) + u64(1234) + u32(5678) + u32(0),
},
{
@@ -412,7 +411,7 @@ func TestGetTypeHasher(t *testing.T) {
},
{
name: "array_ptr_memhash",
val: ptr.To([4]byte{1, 2, 3, 4}),
val: new([4]byte{1, 2, 3, 4}),
out: "\x01\x01\x02\x03\x04",
},
{
@@ -640,7 +639,7 @@ var filterRules = []tailcfg.FilterRule{
SrcIPs: []string{"*", "10.1.3.4/32", "10.0.0.0/24"},
DstPorts: []tailcfg.NetPortRange{{
IP: "1.2.3.4/32",
Bits: ptr.To(32),
Bits: new(32),
Ports: tailcfg.PortRange{First: 1, Last: 2},
}},
IPProto: []int{1, 2, 3, 4},
@@ -823,7 +822,7 @@ func TestHashThroughView(t *testing.T) {
SSHPolicy: &sshPolicyOut{
Rules: []tailcfg.SSHRuleView{
(&tailcfg.SSHRule{
RuleExpires: ptr.To(time.Unix(123, 0)),
RuleExpires: new(time.Unix(123, 0)),
}).View(),
},
},