From 90db063e8b0574c6cc7d87746002032cdb084e42 Mon Sep 17 00:00:00 2001 From: Cristian Ferretti Date: Tue, 2 Jul 2024 12:21:31 -0400 Subject: [PATCH] Followup to review comment: etcdctl checks for min > max. Signed-off-by: Cristian Ferretti --- etcdctl/ctlv3/command/get_command.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etcdctl/ctlv3/command/get_command.go b/etcdctl/ctlv3/command/get_command.go index 25af05fb3f2c..d0ee48038ac3 100644 --- a/etcdctl/ctlv3/command/get_command.go +++ b/etcdctl/ctlv3/command/get_command.go @@ -197,6 +197,11 @@ func getGetOp(args []string) (string, []clientv3.OpOption) { } if getMaxCreateRev > 0 { + if getMinCreateRev > getMaxCreateRev { + cobrautl.ExitWithError(cobrautl.ExitBadFeature, + fmt.Errorf("getMinCreateRev(=%v) > getMaxCreateRev(=%v)", getMinCreateRev, getMaxCreateRev)) + + } opts = append(opts, clientv3.WithMaxCreateRev(getMaxCreateRev)) } @@ -205,6 +210,10 @@ func getGetOp(args []string) (string, []clientv3.OpOption) { } if getMaxModRev > 0 { + if getMinModRev > getMaxModRev { + cobrautl.ExitWithError(cobrautl.ExitBadFeature, + fmt.Errorf("getMinModRev(=%v) > getMaxModRev(=%v)", getMinModRev, getMaxModRev)) + } opts = append(opts, clientv3.WithMaxModRev(getMaxModRev)) }