all: use Go 1.26 things, run most gofix modernizers

I omitted a lot of the min/max modernizers because they didn't
result in more clear code.

Some of it's older "for x := range 123".

Also: errors.AsType, any, fmt.Appendf, etc.

Updates #18682

Change-Id: I83a451577f33877f962766a5b65ce86f7696471c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-03-05 21:13:57 +00:00
committed by Brad Fitzpatrick
parent 4453cc5f53
commit bd2a2d53d3
168 changed files with 431 additions and 618 deletions
+3 -3
View File
@@ -69,7 +69,7 @@ func TestProtoUnmarshalText(t *testing.T) {
for i := range 256 {
var p Proto
must.Do(p.UnmarshalText([]byte(fmt.Sprintf("%d", i))))
must.Do(p.UnmarshalText(fmt.Appendf(nil, "%d", i)))
if got, want := p, Proto(i); got != want {
t.Errorf("Proto(%d) = %v, want %v", i, got, want)
}
@@ -122,7 +122,7 @@ func TestProtoUnmarshalJSON(t *testing.T) {
var p Proto
for i := range 256 {
j := []byte(fmt.Sprintf(`%d`, i))
j := fmt.Appendf(nil, `%d`, i)
must.Do(json.Unmarshal(j, &p))
if got, want := p, Proto(i); got != want {
t.Errorf("Proto(%d) = %v, want %v", i, got, want)
@@ -130,7 +130,7 @@ func TestProtoUnmarshalJSON(t *testing.T) {
}
for name, wantProto := range acceptedNames {
must.Do(json.Unmarshal([]byte(fmt.Sprintf(`"%s"`, name)), &p))
must.Do(json.Unmarshal(fmt.Appendf(nil, `"%s"`, name), &p))
if got, want := p, wantProto; got != want {
t.Errorf("Proto(%q) = %v, want %v", name, got, want)
}