mirror of
https://github.com/golang/go
synced 2024-11-18 18:44:42 -07:00
go/analysis/doc: fix stuff that was left out of the previous commit
I forgot to add the section on supplying AST nodes directly. Change-Id: Ibf9930693cf32542832b21a95621224c8d68e0f2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192682 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
8fa7b020d0
commit
573d992605
@ -121,3 +121,16 @@ it's possible that a new future version of the AST might make this a more
|
||||
viable option.
|
||||
|
||||
### Supplying AST nodes directly
|
||||
|
||||
Another possibility would be for SuggestedFixes to supply the replacement
|
||||
ASTs directly. There is one primary limitation to this: that because
|
||||
comments to ASTs specify their location using token.Pos values, it's very
|
||||
difficult to place any comments in the right place.
|
||||
|
||||
In general, it's also more difficult to generate the AST structures for
|
||||
some code than to generate the text for that code. So we prefer to allow
|
||||
the flexibility to do the latter.
|
||||
|
||||
Because users can call ```format.Node``` to produce the text for any
|
||||
AST node, users will always be able to produce a SuggestedFix from AST
|
||||
nodes. In future, we may choose to add a convenience method that does this for users.
|
||||
|
Loading…
Reference in New Issue
Block a user