aboutsummaryrefslogtreecommitdiff
path: root/columnar
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-06-17 23:23:52 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-06-17 23:23:52 +0200
commitb95ec7449ebec844221f80ecbf7976f3af878eee (patch)
treed8f612b04db980fb878efd0aabb3fe2ba6d3113f /columnar
parentc6b1e6cd164067f623ecd0b1208a73214ea1a0d6 (diff)
downloadgo-gg-b95ec7449ebec844221f80ecbf7976f3af878eee.tar.gz
raise minimum Go version to 1.26
Diffstat (limited to 'columnar')
-rw-r--r--columnar/columnar.go3
-rw-r--r--columnar/columnar_test.go10
2 files changed, 6 insertions, 7 deletions
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]`)
}