From 46a892a0abb0b6b94804386ec1c573b2aef98e18 Mon Sep 17 00:00:00 2001 From: Mantas Vidutis Date: Tue, 18 Apr 2023 17:54:37 -0400 Subject: [PATCH 1/3] make sure that the expected output format is honored. this println is breaking scripts that expect json output when requesting json output --- client/keys/list.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/keys/list.go b/client/keys/list.go index 241c04d8722f..922581f9141a 100644 --- a/client/keys/list.go +++ b/client/keys/list.go @@ -1,6 +1,7 @@ package keys import ( + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -33,7 +34,7 @@ func runListCmd(cmd *cobra.Command, _ []string) error { return err } - if len(records) == 0 { + if (len(records) == 0) && (clientCtx.OutputFormat == flags.OutputFormatText) { cmd.Println("No records were found in keyring") return nil } From 12eaaf120e295fa56eed3b79c8a199ac9ba4d3f3 Mon Sep 17 00:00:00 2001 From: Mantas Vidutis Date: Tue, 18 Apr 2023 17:59:42 -0400 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae2ddf904c0..91fdfa8aa031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,6 +187,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/capability) [#15030](https://github.com/cosmos/cosmos-sdk/pull/15030) Prevent `x/capability` from consuming `GasMeter` gas during `InitMemStore` * (types/coin) [#14739](https://github.com/cosmos/cosmos-sdk/pull/14739) Deprecate the method `Coin.IsEqual` in favour of `Coin.Equal`. The difference between the two methods is that the first one results in a panic when denoms are not equal. This panic lead to unexpected behavior * (x/crypto) [#15258](https://github.com/cosmos/cosmos-sdk/pull/15258) Write keyhash file with permissions 0600 instead of 0555. +* (client/keys) [15867](https://github.com/cosmos/cosmos-sdk/pull/15876) Fix the output of the client keys query when there are no keys ### Deprecated From a1c9ca1584916a5acb364a51de1a6cd59fc697c4 Mon Sep 17 00:00:00 2001 From: Mantas Vidutis Date: Tue, 18 Apr 2023 18:02:47 -0400 Subject: [PATCH 3/3] nit: remove parantheses --- client/keys/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/keys/list.go b/client/keys/list.go index 922581f9141a..e3b3e4f8aea5 100644 --- a/client/keys/list.go +++ b/client/keys/list.go @@ -34,7 +34,7 @@ func runListCmd(cmd *cobra.Command, _ []string) error { return err } - if (len(records) == 0) && (clientCtx.OutputFormat == flags.OutputFormatText) { + if len(records) == 0 && clientCtx.OutputFormat == flags.OutputFormatText { cmd.Println("No records were found in keyring") return nil }