From ebb7e38237e82369d2dc7e290f1c05f4f6191ce6 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Wed, 21 Dec 2022 21:06:15 +0000 Subject: [PATCH] Fix TestPrintDefaults with go >= 1.18 It no longer accepts Println with a constant ending with a newline: Fixes #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. --- flag_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flag_test.go b/flag_test.go index 58a5d25a..8de801c9 100644 --- a/flag_test.go +++ b/flag_test.go @@ -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) } }