Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation notice to godog CLI #489

Merged
merged 2 commits into from Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -9,12 +9,15 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
## Unreleased

### Changed
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))

### Fixed
- Fixed a bug which would ignore the context returned from a substep.([488](https://github.com/cucumber/godog/pull/488) - [wichert](https://github.com/wichert))
- Fixed a bug which would cause a panic when using the pretty formatter with a feature that contained a rule. ([480](https://github.com/cucumber/godog/pull/480) - [dumpsterfireproject](https://github.com/dumpsterfireproject))

### Deprecated
- `godog` CLI tool prints deprecation warning. ([489](https://github.com/cucumber/godog/pull/489) - [vearutop](https://github.com/vearutop))

## [v0.12.5]
### Changed
- Changed underlying cobra command setup to return errors instead of calling `os.Exit` directly to enable simpler testing. ([454](https://github.com/cucumber/godog/pull/454) - [mxygem](https://github.com/mxygem))
Expand Down
5 changes: 5 additions & 0 deletions cmd/godog/internal/cmd_build.go
Expand Up @@ -5,7 +5,9 @@ import (
"go/build"
"path/filepath"

"github.com/cucumber/godog/colors"
"github.com/cucumber/godog/internal/builder"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -37,6 +39,9 @@ The test runner can be executed with the same flags as when using godog run.`,
}

func buildCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))

bin, err := filepath.Abs(buildOutput)
if err != nil {
return fmt.Errorf("could not locate absolute path for: %q. reason: %v", buildOutput, err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/godog/internal/cmd_root.go
Expand Up @@ -44,7 +44,8 @@ func runRootCmd(cmd *cobra.Command, args []string) error {
}
}

fmt.Println(colors.Yellow("Use of godog without a sub-command is deprecated. Please use godog build, godog run or godog version."))
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
return runCmdRunFunc(cmd, args)
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/godog/internal/cmd_run.go
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/spf13/cobra"

"github.com/cucumber/godog/colors"
"github.com/cucumber/godog/internal/builder"
"github.com/cucumber/godog/internal/flags"
)
Expand Down Expand Up @@ -42,6 +43,9 @@ buildable go source.`,
}

func runCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))

osArgs := os.Args[1:]

if len(osArgs) > 0 && osArgs[0] == "run" {
Expand Down