From b95ec7449ebec844221f80ecbf7976f3af878eee Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 17 Jun 2026 23:23:52 +0200 Subject: raise minimum Go version to 1.26 --- columnar/columnar.go | 3 +-- columnar/columnar_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'columnar') diff --git a/columnar/columnar.go b/columnar/columnar.go index 5e339ab..fad6627 100644 --- a/columnar/columnar.go +++ b/columnar/columnar.go @@ -57,8 +57,7 @@ var columnarListTypes = map[reflect.Type]reflect.Type{} type List[T any] []T func foreachRelevantField(t reflect.Type, action func(f reflect.StructField)) { - for idx := range t.NumField() { - f := t.Field(idx) + for f := range t.Fields() { if f.PkgPath == "" && f.Tag.Get("json") != "-" { action(f) } diff --git a/columnar/columnar_test.go b/columnar/columnar_test.go index 70e27c4..3e050ce 100644 --- a/columnar/columnar_test.go +++ b/columnar/columnar_test.go @@ -84,9 +84,9 @@ func TestJSONRoundtripResolvesPointers(t *testing.T) { } testSuccessfulJSONRoundtrip(t, []***Record{ - PointerTo(PointerTo(PointerTo(Record{1, 2}))), - PointerTo(PointerTo(PointerTo(Record{2, 4}))), - PointerTo(PointerTo(PointerTo(Record{3, 6}))), + new(new(new(Record{1, 2}))), + new(new(new(Record{2, 4}))), + new(new(new(Record{3, 6}))), }, jsonmatch.Object{ "Foo": jsonmatch.Array{1, 2, 3}, @@ -103,7 +103,7 @@ func TestJSONRoundtripErrors(t *testing.T) { _, err := json.Marshal(columnar.List[nothingPublic]{{1, 2}}) AssertEqual(t, err.Error(), `json: error calling MarshalJSON for type columnar.List[go.xyrillian.de/gg/columnar_test.nothingPublic·5]: columnar_test.nothingPublic has no exported fields`) - err = json.Unmarshal([]byte(`{}`), PointerTo(columnar.List[nothingPublic]{})) + err = json.Unmarshal([]byte(`{}`), new(columnar.List[nothingPublic]{})) AssertEqual(t, err.Error(), `columnar_test.nothingPublic has no exported fields`) } @@ -113,7 +113,7 @@ func TestJSONUnmarshalFromInconsistentLengths(t *testing.T) { Bar int } - err := json.Unmarshal([]byte(`{"Foo":[1,2],"Bar":[3,4,5]}`), PointerTo(columnar.List[Record]{})) + err := json.Unmarshal([]byte(`{"Foo":[1,2],"Bar":[3,4,5]}`), new(columnar.List[Record]{})) AssertEqual(t, err.Error(), `cannot unmarshal from columns with inconsistent lengths [2 3]`) } -- cgit v1.3.1