mirror of
https://github.com/golang/go
synced 2024-11-18 18:44:42 -07:00
The Go programming language
9a9fb35468
And: add accessor to get the primary from a secondary Package. This change documents a surprising fact about the current go/types resolver implementation, namely that each ast.ImportSpec import "fmt" creates a new ("secondary") Package object for fmt with the same String, Name, Path and Scope as the canonical ("primary") fmt package, but with a different identity. This change also adds an accessor Package.Primary() that returns the primary package associated with a secondary package object, if any. IMHO the current design is wrong, and the resolver should not create secondary packages at all. Even if a package is imported under a non-default name, as in import f "fmt" ... f.Print we should just regard f as a reference to the existing package "fmt", not as the defining identifier for a secondary package. What we would lose by such a change (the connection of the two f's in 'f.Print' and 'import f "fmt"') seems a small price to pay. This CL is thus just a minimal change to permit clients to make progress under the status quo. R=r, gri, crawshaw CC=golang-dev https://golang.org/cl/13626043 |
||
---|---|---|
cmd | ||
dashboard | ||
go | ||
godoc | ||
gotype | ||
importer | ||
oracle | ||
pointer | ||
ssa | ||
.hgignore | ||
AUTHORS | ||
codereview.cfg | ||
CONTRIBUTORS | ||
LICENSE | ||
PATENTS | ||
README |
This subrepository holds the source for various packages and tools that support the Go programming language. Although at least some of the tools themselves will be included in binary Go distributions, the packages from which they are built are of little interest to most Go programmers. To submit changes to this repository, see http://golang.org/doc/contribute.html.