Skip to content

Commit

Permalink
Add deprecation notice to godog CLI (#489)
Browse files Browse the repository at this point in the history
* Add deprecation notice to godog CLI

* Update CHANGELOG
  • Loading branch information
vearutop authored Jul 31, 2022
1 parent d45a9aa commit 6f3e792
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 6f3e792

Please sign in to comment.