This fixes a case where adding an import when there are is no existing import declaration can corrupt the position of comments attached to types. This was the last known goimports/astutil corruption case. See golang.org/issue/6884 for more details. Unfortunately this requires changing the API to add a *token.FileSet, which we should've had before. I will update goimports (the only user of this API?) immediately after submitting this. This CL also contains a hack (used only in this case of no imports): rather than fix the comment positions by hand (something that only Robert might know how to do), it instead just prints the AST, manipulates the source, and re-parses the AST. We can fix up later. Fixes golang/go#6884 R=golang-dev, gri CC=golang-dev https://golang.org/cl/38270043 |
||
|---|---|---|
| astutil | ||
| blog | ||
| call | ||
| cmd | ||
| cover | ||
| dashboard | ||
| go | ||
| godoc | ||
| importer | ||
| oracle | ||
| playground | ||
| pointer | ||
| present | ||
| ssa | ||
| .hgignore | ||
| AUTHORS | ||
| CONTRIBUTORS | ||
| LICENSE | ||
| PATENTS | ||
| README | ||
| codereview.cfg | ||
README
This subrepository holds the source for various packages and tools that support the Go programming language. Some of the tools, godoc and vet for example, are included in binary Go distributions. Others, including the Go oracle and the test coverage tool, can be fetched with "go get". Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs. To submit changes to this repository, see http://golang.org/doc/contribute.html.