Skip to content

Commit

Permalink
Fix TestPrintDefaults with go >= 1.18
Browse files Browse the repository at this point in the history
It no longer accepts Println with a constant ending with a newline:

 Fixes spf13#368

./flag_test.go:1242:3: fmt.Println arg list ends with redundant newline
FAIL    github.com/spf13/pflag [build failed]

Also changing the previous line ven if it si not constant for
consistency.
  • Loading branch information
pterjan committed Dec 21, 2022
1 parent d5e0c06 commit ebb7e38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1238,8 +1238,8 @@ func TestPrintDefaults(t *testing.T) {
fs.PrintDefaults()
got := buf.String()
if got != defaultOutput {
fmt.Println("\n" + got)
fmt.Println("\n" + defaultOutput)
fmt.Print("\n" + got + "\n")
fmt.Print("\n" + defaultOutput + "\n")
t.Errorf("got %q want %q\n", got, defaultOutput)
}
}
Expand Down

0 comments on commit ebb7e38

Please sign in to comment.