aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2016-11-16 12:26:23 +0000
committerIan Lance Taylor <iant@golang.org>2016-11-25 16:41:34 +0000
commit111064925b34bfd60949c09f0d0b06c8f34430f2 (patch)
treebca5661e83255c8f44f58186ed0812c6b4155a26 /src/testing/testing.go
parentf7b2f58cda83634ccbe043b011f4899f859756cb (diff)
downloadgo-111064925b34bfd60949c09f0d0b06c8f34430f2.tar.xz
testing: comment out flag.Parse from example
The TestMain docs explain that flag.Parse() should be called if TestMain itself depends on command-line flags. The issue here is that the example implementation does not use any flags, and thus the flag.Parse call is unnecessary. This leads to people who use this example as a starting point for their own implementations to forget that the call is not necessary in most cases. Comment it out instead of removing the line to keep it as a reminder, as suggested by Minux Ma. Change-Id: I6ffc5413e7036366ae3cf0f069b7065e832a3b45 Reviewed-on: https://go-review.googlesource.com/33273 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 01f5da31d7..f08c5c6b8e 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -196,7 +196,7 @@
// A simple implementation of TestMain is:
//
// func TestMain(m *testing.M) {
-// flag.Parse()
+// // call flag.Parse() here if TestMain uses flags
// os.Exit(m.Run())
// }
//