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.
This commit is contained in:
Zeke Lu 2022-10-25 18:24:53 +08:00
parent 55eaae452c
commit 15fc09d440
1 changed files with 2 additions and 1 deletions

View File

@ -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.
}