From ff49dcf71ea45733f3113c3c37a230aec4ca9ecc Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Wed, 1 Dec 2021 12:06:51 -0800 Subject: [PATCH] Export default parser Signed-off-by: Derek Nola (cherry picked from commit 9cc930e4a3e9f602f619d615582030793ddceb56) --- pkg/configfilearg/defaultparser.go | 4 ++-- pkg/configfilearg/defaultparser_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/configfilearg/defaultparser.go b/pkg/configfilearg/defaultparser.go index 5e4f5c2402..516d0b53ab 100644 --- a/pkg/configfilearg/defaultparser.go +++ b/pkg/configfilearg/defaultparser.go @@ -7,7 +7,7 @@ import ( "github.com/urfave/cli" ) -var defaultParser = &Parser{ +var DefaultParser = &Parser{ After: []string{"server", "agent", "etcd-snapshot:1"}, FlagNames: []string{"--config", "-c"}, EnvName: version.ProgramUpper + "_CONFIG_FILE", @@ -16,7 +16,7 @@ var defaultParser = &Parser{ } func MustParse(args []string) []string { - result, err := defaultParser.Parse(args) + result, err := DefaultParser.Parse(args) if err != nil { logrus.Fatal(err) } diff --git a/pkg/configfilearg/defaultparser_test.go b/pkg/configfilearg/defaultparser_test.go index 67abccb451..b7c09308ef 100644 --- a/pkg/configfilearg/defaultparser_test.go +++ b/pkg/configfilearg/defaultparser_test.go @@ -65,7 +65,7 @@ func Test_UnitMustParse(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defaultParser.DefaultConfig = tt.config + DefaultParser.DefaultConfig = tt.config if got := MustParse(tt.args); !reflect.DeepEqual(got, tt.want) { t.Errorf("MustParse() = %+v\nWant = %+v", got, tt.want) }