From 1169a3c8b9040042cebbaa8c6d3630ac36d4a50f Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 1 May 2026 18:03:19 +0200 Subject: [PATCH] chore: modernize --- charger/keba-udp.go | 2 +- server/db/settings/setting.go | 2 +- server/influxdb.go | 2 +- util/tee.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charger/keba-udp.go b/charger/keba-udp.go index 9b37a42f9..d5d807b0b 100644 --- a/charger/keba-udp.go +++ b/charger/keba-udp.go @@ -147,7 +147,7 @@ func (c *KebaUdp) roundtrip(msg string, report int, res any) error { if report == 0 { // use reflection to write to simple string rv := reflect.ValueOf(res) - if rv.Kind() != reflect.Ptr || rv.IsNil() || rv.Elem().Kind() != reflect.String { + if rv.Kind() != reflect.Pointer || rv.IsNil() || rv.Elem().Kind() != reflect.String { return fmt.Errorf("invalid type: %s", reflect.TypeOf(res)) } diff --git a/server/db/settings/setting.go b/server/db/settings/setting.go index 211c05300..e4979e642 100644 --- a/server/db/settings/setting.go +++ b/server/db/settings/setting.go @@ -210,7 +210,7 @@ func DecodeOtherSliceOrMap(other, res any) error { val := reflect.ValueOf(other) typ := reflect.TypeOf(other) - if typ.Kind() == reflect.Ptr { + if typ.Kind() == reflect.Pointer { typ = typ.Elem() val = reflect.Indirect(val) } diff --git a/server/influxdb.go b/server/influxdb.go index 264394d85..2774b85ee 100644 --- a/server/influxdb.go +++ b/server/influxdb.go @@ -131,7 +131,7 @@ func (m *Influx) writeComplexPoint(writer pointWriter, key string, val any, tags switch typ := reflect.TypeOf(val); { // pointer - case typ.Kind() == reflect.Ptr: + case typ.Kind() == reflect.Pointer: if val := reflect.ValueOf(val); !val.IsNil() { m.writeComplexPoint(writer, key, reflect.Indirect(val).Interface(), tags) } diff --git a/util/tee.go b/util/tee.go index 54375a58f..12820389a 100644 --- a/util/tee.go +++ b/util/tee.go @@ -37,7 +37,7 @@ func (t *Tee) add(out chan<- Param) { func (t *Tee) Run(in <-chan Param) { for msg := range in { // TODO MUST NOT PUBLISH POINTERS (WHO'S VALUES ARE LATER MODIFIED) - // if val := reflect.ValueOf(msg.Val); val.Kind() == reflect.Ptr { + // if val := reflect.ValueOf(msg.Val); val.Kind() == reflect.Pointer { // if ptr := reflect.Indirect(val); ptr.IsValid() { // fmt.Println("DANGER pointer value:", msg.Key) // }