Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ jobs:
strategy:
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
go: [1.16.x, 1.17.x, 1.18.x]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -38,6 +32,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
Comment on lines -41 to +36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that the default is to run with set -e 😯 !

go run build.go toc docs/v1/manual.md
8 changes: 8 additions & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down