From 15fc09d440ebdb5eca7101958d481bf6e9a65beb Mon Sep 17 00:00:00 2001 From: Zeke Lu Date: Tue, 25 Oct 2022 18:24:53 +0800 Subject: [PATCH] flag: clarify that the main func in playground is a test example flag.Example() has this comment: ... one must execute, typically at the start of main (not init!): flag.Parse() We don't run it here because this is not a main function This example function will be renamed to "main" in playground, which makes the comment confusing. I can not find a way to keep the name. So I will simply add more comments to clarify this situation. --- src/flag/example_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/flag/example_test.go b/src/flag/example_test.go index 04a0d20ee4..76d8673306 100644 --- a/src/flag/example_test.go +++ b/src/flag/example_test.go @@ -78,6 +78,7 @@ func Example() { // to enable the flag package to see the flags defined there, one must // execute, typically at the start of main (not init!): // flag.Parse() - // We don't run it here because this is not a main function and + // We don't run it here because this is not a main function (it's renamed to + // "main" in playground, but bear in mind that this is a test example) and // the testing suite has already parsed the flags. }