Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/printer: make ExampleFprint correctly run as online example
function "ExampleFprint" will be rewritten to function "main" when displayed on the godoc pages, so the online example is failed to run: Output: panic: function not found goroutine 1 [running]: main.parseFunc({0x4f772e, 0xf}, {0x4f713f, 0xd}) /tmp/sandbox1264544227/prog.go:23 +0x13b main.main() /tmp/sandbox1264544227/prog.go:30 +0x45 See: https://pkg.go.dev/go/printer#example-Fprint Add printSelf function to prevent the function not found when running in godoc sandbox. Beside, deleting the dummy test function to make the example show the entire file, as we want to show the newly added printSelf function. Change-Id: Ia2b772937081b58a0fce9860838959c95f2d650c GitHub-Last-Rev: bac1189 GitHub-Pull-Request: #53141 Reviewed-on: https://go-review.googlesource.com/c/go/+/409314 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Daniel Martí <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
- Loading branch information