summaryrefslogtreecommitdiff
path: root/src/go/doc/example_internal_test.go
Commit message (Collapse)AuthorAgeFilesLines
* go/doc: group play example importsJonathan Amsterdam2022-05-101-0/+121
When synthesizing a program from a playable example, preserve the grouping of imports. That is, maintain blank lines between imports while removing unused ones. People are used to having those groups because that is what goimports does. It's disconcerting to see the all imports placed together, as the existing code does, especially when the user has already grouped them. For an example, see golang/go#43658. This is an improvement to a fix in pkgsite's fork of go/doc (https://go.googlesource.com/pkgsite/+/7b10ef3861af4a863bf215f63b6de94c681d5af0/internal/godoc/internal/doc/example_pkgsite.go#405). Here I've managed to avoid using a token.FileSet. Change-Id: I65605e6dd53d742a3fe1210c3f982b54e3706198 Reviewed-on: https://go-review.googlesource.com/c/go/+/384837 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com>