aboutsummaryrefslogtreecommitdiff
path: root/flag_test.go
diff options
context:
space:
mode:
authorHu Jun <[email protected]>2025-03-08 14:28:53 -0800
committerHu Jun <[email protected]>2025-03-08 14:28:53 -0800
commitaae8e193d1d01538cb04b9768a722ea18d8aed44 (patch)
tree86ee3a2a7b9c9da6756973ebd67f4956846c60f1 /flag_test.go
parent1118d46dfe34c2d77aee04d819315a21942aa444 (diff)
parent5ca813443bd2a4d9f46a253ea0407d23b3790713 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'flag_test.go')
-rw-r--r--flag_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/flag_test.go b/flag_test.go
index 9faaba4..643f099 100644
--- a/flag_test.go
+++ b/flag_test.go
@@ -433,7 +433,7 @@ func testParseWithUnknownFlags(f *FlagSet, t *testing.T) {
"-u=unknown3Value",
"-p",
"unknown4Value",
- "-q", //another unknown with bool value
+ "-q", // another unknown with bool value
"-y",
"ee",
"--unknown7=unknown7value",
@@ -899,7 +899,7 @@ func TestChangingArgs(t *testing.T) {
// Test that -help invokes the usage message and returns ErrHelp.
func TestHelp(t *testing.T) {
- var helpCalled = false
+ helpCalled := false
fs := NewFlagSet("help test", ContinueOnError)
fs.Usage = func() { helpCalled = true }
var flag bool
@@ -998,6 +998,7 @@ func getDeprecatedFlagSet() *FlagSet {
f.MarkDeprecated("badflag", "use --good-flag instead")
return f
}
+
func TestDeprecatedFlagInDocs(t *testing.T) {
f := getDeprecatedFlagSet()
@@ -1236,8 +1237,8 @@ func TestPrintDefaults(t *testing.T) {
fs.PrintDefaults()
got := buf.String()
if got != defaultOutput {
- fmt.Print("\n" + got + "\n")
- fmt.Print("\n" + defaultOutput + "\n")
+ fmt.Println("\n" + got)
+ fmt.Printf("\n" + defaultOutput)
t.Errorf("got %q want %q\n", got, defaultOutput)
}
}