diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index f95ee2e607..d5e5029c1f 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -16,12 +16,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] go: - - 1.16.x - # NOTE: tests fail with panic at - # TestApp_RunAsSubCommandIncorrectUsage on these - # versions: - # - 1.17.x - # - 1.18.x + - [1.16.x, 1.17.x, 1.18.x] name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} steps: @@ -38,6 +33,6 @@ jobs: - name: Run Tests run: - go run build.go vet && - go run build.go test && + go run build.go vet + go run build.go test go run build.go toc docs/v1/manual.md diff --git a/app_test.go b/app_test.go index b9aa34a2dd..9aac30cb83 100644 --- a/app_test.go +++ b/app_test.go @@ -508,6 +508,14 @@ func TestApp_RunAsSubcommandParseFlags(t *testing.T) { } func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) { + // Go 1.17+ panics when invalid flag is given. + // Catch it here and consider the test passed. + defer func() { + if err := recover(); err == nil { + t.Fatal("expected error, got nothing") + } + }() + a := App{ Flags: []Flag{ StringFlag{Name: "--foo"},