From 8eb991372fe316144fb3bf24d7e60f6ba7fcb489 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 26 Aug 2025 14:49:54 +0200 Subject: [PATCH] Replace `interface{}` with `any` The changes are made by the Go's modernizer analyzer tool `go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=efaceany -fix -test './...'` --- cmd/icingadb-migrate/cache.go | 12 ++++++------ cmd/icingadb-migrate/convert.go | 24 ++++++++++++------------ cmd/icingadb-migrate/main.go | 12 ++++++------ cmd/icingadb-migrate/misc.go | 8 ++++---- pkg/icingadb/entitiesbyid.go | 4 ++-- pkg/icingadb/history/sync.go | 2 +- pkg/icingadb/overdue/sync.go | 14 +++++++------- pkg/icingadb/runtime_updates.go | 8 ++++---- pkg/icingadb/scoped_entity.go | 6 +++--- pkg/icingadb/v1/customvar.go | 4 ++-- pkg/icingadb/v1/history/ack.go | 2 +- pkg/icingadb/v1/history/comment.go | 2 +- pkg/icingadb/v1/history/downtime.go | 4 ++-- pkg/icingadb/v1/history/flapping.go | 2 +- pkg/icingadb/v1/history/meta.go | 4 ++-- pkg/icingadb/v1/history/notification.go | 2 +- pkg/icingaredis/v1/stats_message.go | 4 ++-- 17 files changed, 57 insertions(+), 57 deletions(-) diff --git a/cmd/icingadb-migrate/cache.go b/cmd/icingadb-migrate/cache.go index d1854c9a..48dfa738 100644 --- a/cmd/icingadb-migrate/cache.go +++ b/cmd/icingadb-migrate/cache.go @@ -52,7 +52,7 @@ func buildEventTimeCache(ht *historyType, idoColumns []string) { ht.idoIdColumn+" <= :toid AND xh."+ ht.idoIdColumn+" > :checkpoint ORDER BY xh."+ht.idoIdColumn+" LIMIT :bulk", nil, checkpoint.MaxId.Int64, // ... since we were interrupted: - func(idoRows []row) (checkpoint interface{}) { + func(idoRows []row) (checkpoint any) { for _, idoRow := range idoRows { if idoRow.EventIsStart == 0 { // Ack/flapping end event. Get the start event time: @@ -163,7 +163,7 @@ func buildPreviousHardStateCache(ht *historyType, idoColumns []string) { ht.idoIdColumn+" <= :toid AND xh."+ ht.idoIdColumn+" < :checkpoint ORDER BY xh."+ht.idoIdColumn+" DESC LIMIT :bulk", nil, checkpoint, // ... since we were interrupted: - func(idoRows []row) (checkpoint interface{}) { + func(idoRows []row) (checkpoint any) { for _, idoRow := range idoRows { var nhs []struct{ NextHardState uint8 } cacheSelect(*tx, &nhs, "SELECT next_hard_state FROM next_hard_state WHERE object_id=?", idoRow.ObjectId) @@ -274,8 +274,8 @@ func chunkCacheTx(cache *sqlx.DB, do func(tx **sqlx.Tx, commitPeriodically func( // cacheGet does cache.Get(dest, query, args...). (On non-recoverable errors the whole program exits.) func cacheGet(cache interface { - Get(dest interface{}, query string, args ...interface{}) error -}, dest interface{}, query string, args ...interface{}) { + Get(dest any, query string, args ...any) error +}, dest any, query string, args ...any) { if err := cache.Get(dest, query, args...); err != nil { log.With("backend", "cache", "query", query, "args", args). Fatalf("%+v", errors.Wrap(err, "can't perform query")) @@ -283,7 +283,7 @@ func cacheGet(cache interface { } // cacheSelect does cacheTx.Select(dest, query, args...). (On non-recoverable errors the whole program exits.) -func cacheSelect(cacheTx *sqlx.Tx, dest interface{}, query string, args ...interface{}) { +func cacheSelect(cacheTx *sqlx.Tx, dest any, query string, args ...any) { if err := cacheTx.Select(dest, query, args...); err != nil { log.With("backend", "cache", "query", query, "args", args). Fatalf("%+v", errors.Wrap(err, "can't perform query")) @@ -291,7 +291,7 @@ func cacheSelect(cacheTx *sqlx.Tx, dest interface{}, query string, args ...inter } // cacheExec does cacheTx.Exec(dml, args...). On non-recoverable errors the whole program exits. -func cacheExec(cacheTx *sqlx.Tx, dml string, args ...interface{}) { +func cacheExec(cacheTx *sqlx.Tx, dml string, args ...any) { if _, err := cacheTx.Exec(dml, args...); err != nil { log.With("backend", "cache", "dml", dml, "args", args).Fatalf("%+v", errors.Wrap(err, "can't perform DML")) } diff --git a/cmd/icingadb-migrate/convert.go b/cmd/icingadb-migrate/convert.go index 9cd4d537..8a9a618d 100644 --- a/cmd/icingadb-migrate/convert.go +++ b/cmd/icingadb-migrate/convert.go @@ -52,7 +52,7 @@ type commentRow = struct { func convertCommentRows( env string, envId types.Binary, - _ func(interface{}, string, ...interface{}), _ *sqlx.Tx, idoRows []commentRow, + _ func(any, string, ...any), _ *sqlx.Tx, idoRows []commentRow, ) (stages []icingaDbOutputStage, checkpoint any) { var commentHistory, acknowledgementHistory, allHistoryComment, allHistoryAck []database.Entity @@ -238,7 +238,7 @@ type downtimeRow = struct { func convertDowntimeRows( env string, envId types.Binary, - _ func(interface{}, string, ...interface{}), _ *sqlx.Tx, idoRows []downtimeRow, + _ func(any, string, ...any), _ *sqlx.Tx, idoRows []downtimeRow, ) (stages []icingaDbOutputStage, checkpoint any) { var downtimeHistory, allHistory, sla []database.Entity @@ -395,7 +395,7 @@ type flappingRow = struct { func convertFlappingRows( env string, envId types.Binary, - selectCache func(dest interface{}, query string, args ...interface{}), _ *sqlx.Tx, idoRows []flappingRow, + selectCache func(dest any, query string, args ...any), _ *sqlx.Tx, idoRows []flappingRow, ) (stages []icingaDbOutputStage, checkpoint any) { if len(idoRows) < 1 { return @@ -449,7 +449,7 @@ func convertFlappingRows( hostId := calcObjectId(env, row.Name1) serviceId := calcServiceId(env, row.Name1, row.Name2) startTime := float64(start.Time().UnixMilli()) - flappingHistoryId := hashAny([]interface{}{env, name, startTime}) + flappingHistoryId := hashAny([]any{env, name, startTime}) if row.EventType == 1001 { // end // The start counterpart should already have been inserted. @@ -475,7 +475,7 @@ func convertFlappingRows( h := &history.HistoryFlapping{ HistoryMeta: history.HistoryMeta{ HistoryEntity: history.HistoryEntity{ - Id: hashAny([]interface{}{env, "flapping_end", name, startTime}), + Id: hashAny([]any{env, "flapping_end", name, startTime}), }, EnvironmentId: envId, ObjectType: typ, @@ -512,7 +512,7 @@ func convertFlappingRows( h := &history.HistoryFlapping{ HistoryMeta: history.HistoryMeta{ HistoryEntity: history.HistoryEntity{ - Id: hashAny([]interface{}{env, "flapping_start", name, startTime}), + Id: hashAny([]any{env, "flapping_start", name, startTime}), }, EnvironmentId: envId, ObjectType: typ, @@ -553,7 +553,7 @@ type notificationRow = struct { func convertNotificationRows( env string, envId types.Binary, - selectCache func(dest interface{}, query string, args ...interface{}), ido *sqlx.Tx, idoRows []notificationRow, + selectCache func(dest any, query string, args ...any), ido *sqlx.Tx, idoRows []notificationRow, ) (stages []icingaDbOutputStage, checkpoint any) { if len(idoRows) < 1 { return @@ -628,8 +628,8 @@ func convertNotificationRows( ts := convertTime(row.EndTime.Int64, row.EndTimeUsec) tsMilli := float64(ts.Time().UnixMilli()) - notificationHistoryId := hashAny([]interface{}{env, name, notificationType, tsMilli}) - id := hashAny([]interface{}{env, "notification", name, notificationType, tsMilli}) + notificationHistoryId := hashAny([]any{env, name, notificationType, tsMilli}) + id := hashAny([]any{env, "notification", name, notificationType, tsMilli}) typ := objectTypes[row.ObjecttypeId] hostId := calcObjectId(env, row.Name1) serviceId := calcServiceId(env, row.Name1, row.Name2) @@ -761,7 +761,7 @@ type stateRow = struct { func convertStateRows( env string, envId types.Binary, - selectCache func(dest interface{}, query string, args ...interface{}), _ *sqlx.Tx, idoRows []stateRow, + selectCache func(dest any, query string, args ...any), _ *sqlx.Tx, idoRows []stateRow, ) (stages []icingaDbOutputStage, checkpoint any) { if len(idoRows) < 1 { return @@ -797,8 +797,8 @@ func convertStateRows( name := strings.Join([]string{row.Name1, row.Name2}, "!") ts := convertTime(row.StateTime.Int64, row.StateTimeUsec) tsMilli := float64(ts.Time().UnixMilli()) - stateHistoryId := hashAny([]interface{}{env, name, tsMilli}) - id := hashAny([]interface{}{env, "state_change", name, tsMilli}) + stateHistoryId := hashAny([]any{env, name, tsMilli}) + id := hashAny([]any{env, "state_change", name, tsMilli}) typ := objectTypes[row.ObjecttypeId] hostId := calcObjectId(env, row.Name1) serviceId := calcServiceId(env, row.Name1, row.Name2) diff --git a/cmd/icingadb-migrate/main.go b/cmd/icingadb-migrate/main.go index 09fc6d69..af1254dd 100644 --- a/cmd/icingadb-migrate/main.go +++ b/cmd/icingadb-migrate/main.go @@ -376,7 +376,7 @@ func migrate(c *Config, idb *database.DB, envId []byte) { func migrateOneType[IdoRow any]( c *Config, idb *database.DB, envId []byte, ht *historyType, convertRows func(env string, envId types.Binary, - selectCache func(dest interface{}, query string, args ...interface{}), ido *sqlx.Tx, + selectCache func(dest any, query string, args ...any), ido *sqlx.Tx, idoRows []IdoRow) (stages []icingaDbOutputStage, checkpoint any), ) { var lastQuery string @@ -388,7 +388,7 @@ func migrateOneType[IdoRow any]( } }() - selectCache := func(dest interface{}, query string, args ...interface{}) { + selectCache := func(dest any, query string, args ...any) { // Prepare new one, if old one doesn't fit anymore. if query != lastQuery { if lastStmt != nil { @@ -412,14 +412,14 @@ func migrateOneType[IdoRow any]( } } - var args map[string]interface{} + var args map[string]any // For the case that the cache was older that the IDO, // but ht.cacheFiller couldn't update it, limit (WHERE) our source data set. if ht.cacheLimitQuery != "" { var limit sql.NullInt64 cacheGet(ht.cache, &limit, ht.cacheLimitQuery) - args = map[string]interface{}{"cache_limit": limit.Int64} + args = map[string]any{"cache_limit": limit.Int64} } upsertProgress, _ := idb.BuildUpsertStmt(&IdoMigrationProgress{}) @@ -430,7 +430,7 @@ func migrateOneType[IdoRow any]( // Stream IDO rows, ... sliceIdoHistory( ht, ht.migrationQuery, args, ht.lastId, - func(idoRows []IdoRow) (checkpoint interface{}) { + func(idoRows []IdoRow) (checkpoint any) { // ... convert them, ... stages, lastIdoId := convertRows(c.Icinga2.Env, envId, selectCache, ht.snapshot, idoRows) @@ -457,7 +457,7 @@ func migrateOneType[IdoRow any]( } if lastIdoId != nil { - args := map[string]interface{}{"history_type": ht.name, "last_ido_id": lastIdoId} + args := map[string]any{"history_type": ht.name, "last_ido_id": lastIdoId} _, err := idb.NamedExec(upsertProgress, &IdoMigrationProgress{ IdoMigrationProgressUpserter{lastIdoId}, envIdHex, ht.name, c.IDO.From, c.IDO.To, diff --git a/cmd/icingadb-migrate/misc.go b/cmd/icingadb-migrate/misc.go index 8a63825f..e1d1ddd9 100644 --- a/cmd/icingadb-migrate/misc.go +++ b/cmd/icingadb-migrate/misc.go @@ -21,7 +21,7 @@ type IdoMigrationProgressUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (impu *IdoMigrationProgressUpserter) Upsert() interface{} { +func (impu *IdoMigrationProgressUpserter) Upsert() any { return impu } @@ -53,7 +53,7 @@ var log = func() *zap.SugaredLogger { var objectTypes = map[uint8]string{1: "host", 2: "service"} // hashAny combines objectpacker.PackAny and SHA1 hashing. -func hashAny(in interface{}) []byte { +func hashAny(in any) []byte { hash := sha1.New() // #nosec G401 -- used as a non-cryptographic hash function to hash IDs if err := objectpacker.PackAny(in, hash); err != nil { panic(err) @@ -97,10 +97,10 @@ func calcServiceId(env, name1, name2 string) []byte { // (On non-recoverable errors the whole program exits.) func sliceIdoHistory[Row any]( ht *historyType, query string, args map[string]any, - checkpoint interface{}, onRows func([]Row) (checkpoint interface{}), + checkpoint any, onRows func([]Row) (checkpoint any), ) { if args == nil { - args = map[string]interface{}{} + args = map[string]any{} } args["fromid"] = ht.fromId diff --git a/pkg/icingadb/entitiesbyid.go b/pkg/icingadb/entitiesbyid.go index 019e15f1..d5b4ac19 100644 --- a/pkg/icingadb/entitiesbyid.go +++ b/pkg/icingadb/entitiesbyid.go @@ -19,8 +19,8 @@ func (ebi EntitiesById) Keys() []string { } // IDs returns the contracts.ID of the entities. -func (ebi EntitiesById) IDs() []interface{} { - ids := make([]interface{}, 0, len(ebi)) +func (ebi EntitiesById) IDs() []any { + ids := make([]any, 0, len(ebi)) for _, v := range ebi { ids = append(ids, v.(database.IDer).ID()) } diff --git a/pkg/icingadb/history/sync.go b/pkg/icingadb/history/sync.go index 5838391f..2537a047 100644 --- a/pkg/icingadb/history/sync.go +++ b/pkg/icingadb/history/sync.go @@ -177,7 +177,7 @@ type stageFunc func(ctx context.Context, s Sync, key string, in <-chan redis.XMe // writeOneEntityStage creates a stageFunc from a pointer to a struct implementing the v1.UpserterEntity interface. // For each history event it receives, it parses that event into a new instance of that entity type and writes it to // the database. It writes exactly one entity to the database for each history event. -func writeOneEntityStage(structPtr interface{}) stageFunc { +func writeOneEntityStage(structPtr any) stageFunc { structifier := structify.MakeMapStructifier( reflect.TypeOf(structPtr).Elem(), "json", diff --git a/pkg/icingadb/overdue/sync.go b/pkg/icingadb/overdue/sync.go index 3f431b71..65e8bcce 100644 --- a/pkg/icingadb/overdue/sync.go +++ b/pkg/icingadb/overdue/sync.go @@ -93,7 +93,7 @@ func (s Sync) initSync(ctx context.Context, objectType string) error { key := "icingadb:overdue:" + objectType pipe.Del(ctx, key) - var ids []interface{} + var ids []any for _, row := range rows { ids = append(ids, row.Id.String()) if len(ids) == 100 { @@ -164,15 +164,15 @@ func (s Sync) sync(ctx context.Context, objectType string, factory factory, coun return errors.Wrap(err, "can't execute Redis script") } - root := overdues.([]interface{}) + root := overdues.([]any) g, ctx := errgroup.WithContext(ctx) g.Go(func() error { - return s.updateOverdue(ctx, objectType, factory, counter, root[0].([]interface{}), true) + return s.updateOverdue(ctx, objectType, factory, counter, root[0].([]any), true) }) g.Go(func() error { - return s.updateOverdue(ctx, objectType, factory, counter, root[1].([]interface{}), false) + return s.updateOverdue(ctx, objectType, factory, counter, root[1].([]any), false) }) if err := g.Wait(); err != nil { @@ -193,7 +193,7 @@ func (s Sync) sync(ctx context.Context, objectType string, factory factory, coun // updateOverdue sets objectType_state#is_overdue for ids to overdue // and updates icingadb:overdue:objectType respectively. func (s Sync) updateOverdue( - ctx context.Context, objectType string, factory factory, counter *com.Counter, ids []interface{}, overdue bool, + ctx context.Context, objectType string, factory factory, counter *com.Counter, ids []any, overdue bool, ) error { if len(ids) < 1 { return nil @@ -206,7 +206,7 @@ func (s Sync) updateOverdue( counter.Add(uint64(len(ids))) telemetry.Stats.Overdue.Add(uint64(len(ids))) - var op func(ctx context.Context, key string, members ...interface{}) *redis.IntCmd + var op func(ctx context.Context, key string, members ...any) *redis.IntCmd if overdue { op = s.redis.SAdd } else { @@ -218,7 +218,7 @@ func (s Sync) updateOverdue( } // updateDb sets objectType_state#is_overdue for ids to overdue. -func (s Sync) updateDb(ctx context.Context, factory factory, ids []interface{}, overdue bool) error { +func (s Sync) updateDb(ctx context.Context, factory factory, ids []any, overdue bool) error { g, ctx := errgroup.WithContext(ctx) ch := make(chan database.Entity, 1<<10) diff --git a/pkg/icingadb/runtime_updates.go b/pkg/icingadb/runtime_updates.go index 46d7bbe2..c84052fd 100644 --- a/pkg/icingadb/runtime_updates.go +++ b/pkg/icingadb/runtime_updates.go @@ -73,16 +73,16 @@ func (r *RuntimeUpdates) Sync( updateMessages := make(chan redis.XMessage, r.redis.Options.XReadCount) upsertEntities := make(chan database.Entity, r.redis.Options.XReadCount) - deleteIds := make(chan interface{}, r.redis.Options.XReadCount) + deleteIds := make(chan any, r.redis.Options.XReadCount) var upsertedFifo chan database.Entity - var deletedFifo chan interface{} + var deletedFifo chan any var upsertCount int var deleteCount int upsertStmt, upsertPlaceholders := r.db.BuildUpsertStmt(s.Entity()) if !allowParallel { upsertedFifo = make(chan database.Entity, 1) - deletedFifo = make(chan interface{}, 1) + deletedFifo = make(chan any, 1) upsertCount = 1 deleteCount = 1 } else { @@ -148,7 +148,7 @@ func (r *RuntimeUpdates) Sync( { updateMessages := make(chan redis.XMessage, r.redis.Options.XReadCount) upsertEntities := make(chan database.Entity, r.redis.Options.XReadCount) - deleteIds := make(chan interface{}, r.redis.Options.XReadCount) + deleteIds := make(chan any, r.redis.Options.XReadCount) cv := common.NewSyncSubject(v1.NewCustomvar) cvFlat := common.NewSyncSubject(v1.NewCustomvarFlat) diff --git a/pkg/icingadb/scoped_entity.go b/pkg/icingadb/scoped_entity.go index 5a77e7c5..b8f96cc1 100644 --- a/pkg/icingadb/scoped_entity.go +++ b/pkg/icingadb/scoped_entity.go @@ -9,11 +9,11 @@ import ( // enclosed entity type must satisfy in order to be SELECTed. type ScopedEntity struct { database.Entity - scope interface{} + scope any } // Scope implements the contracts.Scoper interface. -func (e ScopedEntity) Scope() interface{} { +func (e ScopedEntity) Scope() any { return e.scope } @@ -23,7 +23,7 @@ func (e ScopedEntity) TableName() string { } // NewScopedEntity returns a new ScopedEntity. -func NewScopedEntity(entity database.Entity, scope interface{}) *ScopedEntity { +func NewScopedEntity(entity database.Entity, scope any) *ScopedEntity { return &ScopedEntity{ Entity: entity, scope: scope, diff --git a/pkg/icingadb/v1/customvar.go b/pkg/icingadb/v1/customvar.go index a9a866dd..7aa73bbe 100644 --- a/pkg/icingadb/v1/customvar.go +++ b/pkg/icingadb/v1/customvar.go @@ -106,7 +106,7 @@ func flattenCustomvars(ctx context.Context, g *errgroup.Group, cvs <-chan databa for i := 0; i < runtime.NumCPU(); i++ { g.Go(func() error { for entity := range cvs { - var value interface{} + var value any customvar := entity.(*Customvar) if err := types.UnmarshalJSON([]byte(customvar.Value), &value); err != nil { return err @@ -115,7 +115,7 @@ func flattenCustomvars(ctx context.Context, g *errgroup.Group, cvs <-chan databa flattened := flatten.Flatten(value, customvar.Name) for flatname, flatvalue := range flattened { - var fv interface{} + var fv any if flatvalue.Valid { fv = flatvalue.String } diff --git a/pkg/icingadb/v1/history/ack.go b/pkg/icingadb/v1/history/ack.go index f89a9ada..1db55dab 100644 --- a/pkg/icingadb/v1/history/ack.go +++ b/pkg/icingadb/v1/history/ack.go @@ -14,7 +14,7 @@ type AckHistoryUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (ahu *AckHistoryUpserter) Upsert() interface{} { +func (ahu *AckHistoryUpserter) Upsert() any { return ahu } diff --git a/pkg/icingadb/v1/history/comment.go b/pkg/icingadb/v1/history/comment.go index 4af162e6..cad9ebf5 100644 --- a/pkg/icingadb/v1/history/comment.go +++ b/pkg/icingadb/v1/history/comment.go @@ -34,7 +34,7 @@ type CommentHistoryUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (chu *CommentHistoryUpserter) Upsert() interface{} { +func (chu *CommentHistoryUpserter) Upsert() any { return chu } diff --git a/pkg/icingadb/v1/history/downtime.go b/pkg/icingadb/v1/history/downtime.go index ec3c8d66..5860d4c1 100644 --- a/pkg/icingadb/v1/history/downtime.go +++ b/pkg/icingadb/v1/history/downtime.go @@ -33,7 +33,7 @@ type DowntimeHistoryUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (dhu *DowntimeHistoryUpserter) Upsert() interface{} { +func (dhu *DowntimeHistoryUpserter) Upsert() any { return dhu } @@ -101,7 +101,7 @@ type SlaHistoryDowntimeUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (h *SlaHistoryDowntimeUpserter) Upsert() interface{} { +func (h *SlaHistoryDowntimeUpserter) Upsert() any { return h } diff --git a/pkg/icingadb/v1/history/flapping.go b/pkg/icingadb/v1/history/flapping.go index bd86f620..78f0a190 100644 --- a/pkg/icingadb/v1/history/flapping.go +++ b/pkg/icingadb/v1/history/flapping.go @@ -16,7 +16,7 @@ type FlappingHistoryUpserter struct { } // Upsert implements the contracts.Upserter interface. -func (fhu *FlappingHistoryUpserter) Upsert() interface{} { +func (fhu *FlappingHistoryUpserter) Upsert() any { return fhu } diff --git a/pkg/icingadb/v1/history/meta.go b/pkg/icingadb/v1/history/meta.go index 0f23908f..1990d69b 100644 --- a/pkg/icingadb/v1/history/meta.go +++ b/pkg/icingadb/v1/history/meta.go @@ -19,7 +19,7 @@ type HistoryTableEntity struct { // Upsert implements the contracts.Upserter interface. // Update only the Id (effectively nothing). -func (hte HistoryTableEntity) Upsert() interface{} { +func (hte HistoryTableEntity) Upsert() any { return hte } @@ -45,7 +45,7 @@ func (he *HistoryEntity) SetID(id database.ID) { // Upsert implements the contracts.Upserter interface. // Update only the Id (effectively nothing). -func (he HistoryEntity) Upsert() interface{} { +func (he HistoryEntity) Upsert() any { return he } diff --git a/pkg/icingadb/v1/history/notification.go b/pkg/icingadb/v1/history/notification.go index 1d508f23..e98e65fb 100644 --- a/pkg/icingadb/v1/history/notification.go +++ b/pkg/icingadb/v1/history/notification.go @@ -28,7 +28,7 @@ type UserNotificationHistory struct { UserId types.Binary `json:"user_id"` } -func (u *UserNotificationHistory) Upsert() interface{} { +func (u *UserNotificationHistory) Upsert() any { return u } diff --git a/pkg/icingaredis/v1/stats_message.go b/pkg/icingaredis/v1/stats_message.go index 0798468a..33214895 100644 --- a/pkg/icingaredis/v1/stats_message.go +++ b/pkg/icingaredis/v1/stats_message.go @@ -6,10 +6,10 @@ import ( ) // StatsMessage represents a message from the Redis stream icinga:stats. -type StatsMessage map[string]interface{} +type StatsMessage map[string]any // Raw returns the key-value pairs of the message. -func (m StatsMessage) Raw() map[string]interface{} { +func (m StatsMessage) Raw() map[string]any { return m }