From cdf3bfc09955175473849fc7fb5978733d089957 Mon Sep 17 00:00:00 2001 From: Rickard Englund Date: Sun, 30 May 2021 19:14:26 +0200 Subject: [PATCH] removed renamed imports of pflag. This was causing way to much investigating in order for me to find That I've only copied parts of the examples resulting in "flag".Parse instead of pflag.Parse() --- README.md | 9 ++++----- _examples/assert-godogs/godogs_test.go | 6 +++--- _examples/godogs/godogs_test.go | 6 +++--- cmd/godog/internal/cmd_root.go | 4 ++-- release-notes/v0.11.0.md | 8 ++++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index d5ce43d..b5fb1a2 100644 --- a/README.md +++ b/README.md @@ -346,13 +346,12 @@ The following example binds **godog** flags with specified prefix `godog` in ord package main import ( - "flag" // godog v0.10.0 and earlier "os" "testing" "github.com/cucumber/godog" "github.com/cucumber/godog/colors" - flag "github.com/spf13/pflag" // godog v0.11.0 (latest) + "github.com/spf13/pflag" // godog v0.11.0 (latest) ) var opts = godog.Options{ @@ -361,13 +360,13 @@ var opts = godog.Options{ } func init() { - godog.BindFlags("godog.", flag.CommandLine, &opts) // godog v0.10.0 and earlier + godog.BindFlags("godog.", pflag.CommandLine, &opts) // godog v0.10.0 and earlier godog.BindCommandLineFlags("godog.", &opts) // godog v0.11.0 (latest) } func TestMain(m *testing.M) { - flag.Parse() - opts.Paths = flag.Args() + pflag.Parse() + opts.Paths = pflag.Args() status := godog.TestSuite{ Name: "godogs", diff --git a/_examples/assert-godogs/godogs_test.go b/_examples/assert-godogs/godogs_test.go index b1383b4..f48b04c 100644 --- a/_examples/assert-godogs/godogs_test.go +++ b/_examples/assert-godogs/godogs_test.go @@ -7,7 +7,7 @@ import ( "github.com/cucumber/godog" "github.com/cucumber/godog/colors" - flag "github.com/spf13/pflag" + "github.com/spf13/pflag" "github.com/stretchr/testify/assert" ) @@ -18,8 +18,8 @@ func init() { } func TestMain(m *testing.M) { - flag.Parse() - opts.Paths = flag.Args() + pflag.Parse() + opts.Paths = pflag.Args() status := godog.TestSuite{ Name: "godogs", diff --git a/_examples/godogs/godogs_test.go b/_examples/godogs/godogs_test.go index b6fa3f9..1aaffb8 100644 --- a/_examples/godogs/godogs_test.go +++ b/_examples/godogs/godogs_test.go @@ -7,7 +7,7 @@ import ( "github.com/cucumber/godog" "github.com/cucumber/godog/colors" - flag "github.com/spf13/pflag" + "github.com/spf13/pflag" ) var opts = godog.Options{Output: colors.Colored(os.Stdout)} @@ -17,8 +17,8 @@ func init() { } func TestMain(m *testing.M) { - flag.Parse() - opts.Paths = flag.Args() + pflag.Parse() + opts.Paths = pflag.Args() status := godog.TestSuite{ Name: "godogs", diff --git a/cmd/godog/internal/cmd_root.go b/cmd/godog/internal/cmd_root.go index 8545873..34b9918 100644 --- a/cmd/godog/internal/cmd_root.go +++ b/cmd/godog/internal/cmd_root.go @@ -2,7 +2,7 @@ package internal import ( "github.com/spf13/cobra" - flag "github.com/spf13/pflag" + "github.com/spf13/pflag" "github.com/cucumber/godog/internal/flags" ) @@ -40,7 +40,7 @@ and contain buildable go source.`, return rootCmd } -func bindRootCmdFlags(flagSet *flag.FlagSet) { +func bindRootCmdFlags(flagSet *pflag.FlagSet) { flagSet.StringVarP(&output, "output", "o", "", "compiles the test runner to the named file") flagSet.BoolVar(&version, "version", false, "show current version") diff --git a/release-notes/v0.11.0.md b/release-notes/v0.11.0.md index c41ea8e..726cb81 100644 --- a/release-notes/v0.11.0.md +++ b/release-notes/v0.11.0.md @@ -65,7 +65,7 @@ import ( "github.com/cucumber/godog" "github.com/cucumber/godog/colors" - flag "github.com/spf13/pflag" + "github.com/spf13/pflag" ) var opts = godog.Options{Output: colors.Colored(os.Stdout)} @@ -75,8 +75,8 @@ func init() { } func TestMain(m *testing.M) { - flag.Parse() - opts.Paths = flag.Args() + pflag.Parse() + opts.Paths = pflag.Args() // ... ``` @@ -91,4 +91,4 @@ To build a test binary, `godog --output g.test []`has been replaced wit Full change log --------------- -See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md#v0110-rc1). \ No newline at end of file +See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md#v0110-rc1).