From 1547ac2f6a3d3d39fe4d49570c0d1c2401a8f20e Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Wed, 11 Sep 2019 14:15:20 +0530 Subject: [PATCH] Modify variable names --- context.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/context.go b/context.go index 8f1dcd8..485f529 100644 --- a/context.go +++ b/context.go @@ -314,16 +314,14 @@ func checkRequiredFlags(flags []Flag, context *Context) requiredFlagsErr { for _, f := range flags { if rf, ok := f.(RequiredFlag); ok && rf.IsRequired() { key := strings.Split(f.GetName(), ",") - shortName := strings.TrimSpace(key[0]) if len(key) > 1 { // has short name - longName := strings.TrimSpace(key[1]) - if !context.IsSet(shortName) && !context.IsSet(longName) { + if !context.IsSet(strings.TrimSpace(key[0])) && !context.IsSet(strings.TrimSpace(key[1])) { missingFlags = append(missingFlags, key[0]) } } else { // does not have short name - if !context.IsSet(shortName) { + if !context.IsSet(strings.TrimSpace(key[0])) { missingFlags = append(missingFlags, key[0]) } }