From ea58be3113d96e4d1c6018bef90ac9538e21ba8a Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Fri, 6 Sep 2024 08:51:50 +0200 Subject: [PATCH] Fix two go vet issues in the kvstore handlers daemon/daemonapi/get_object_kvstore_keys.go:51:40: github.com/opensvc/om3/util/key.T struct literal uses unkeyed fields daemon/daemonapi/get_object_kvstore_entry.go:53:3: unreachable code --- daemon/daemonapi/get_object_kvstore_entry.go | 1 - daemon/daemonapi/get_object_kvstore_keys.go | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/daemonapi/get_object_kvstore_entry.go b/daemon/daemonapi/get_object_kvstore_entry.go index 2129b7755..758b0e403 100644 --- a/daemon/daemonapi/get_object_kvstore_entry.go +++ b/daemon/daemonapi/get_object_kvstore_entry.go @@ -50,7 +50,6 @@ func (a *DaemonAPI) GetObjectKVStoreEntry(ctx echo.Context, namespace string, ki } return ctx.Blob(http.StatusOK, contentType, b) } - return ctx.NoContent(http.StatusNoContent) } for nodename := range instanceConfigData { diff --git a/daemon/daemonapi/get_object_kvstore_keys.go b/daemon/daemonapi/get_object_kvstore_keys.go index 9a0cf8a49..e5b27f772 100644 --- a/daemon/daemonapi/get_object_kvstore_keys.go +++ b/daemon/daemonapi/get_object_kvstore_keys.go @@ -44,11 +44,16 @@ func (a *DaemonAPI) GetObjectKVStoreKeys(ctx echo.Context, namespace string, kin } else { items := make(api.KVStoreKeyListItems, 0) for _, name := range names { + configKey := key.T{ + Section: "data", + Option: name, + } + size := len(ks.Config().GetString(configKey)) items = append(items, api.KVStoreKeyListItem{ Object: p.String(), Node: a.localhost, Key: name, - Size: len(ks.Config().GetString(key.T{"data", name})), + Size: size, }) } return ctx.JSON(http.StatusOK, api.KVStoreKeyList{