go/loader creates a fresh package map for each source package it imports. In
llgoi this caused binary imported packages to be imported anew for every
input line, resulting in spurious type errors and panics in go/ssa when
encountering previously imported types. Fix this by ignoring the provided
package map completely in the importer wrapper and using our own.
Details
Details
Diff Detail
Diff Detail
Event Timeline
cmd/llgoi/llgoi.go | ||
---|---|---|
102–103 | I'd prefer if we stuck to the contract of go/types.Importer (as before), and instead just set go/types.Config.Packages to the same map each time. I understand that the package map is only read/updated by the importer currently, but I'm not sure if that's guaranteed to be the case forever. Perhaps I'm being paranoid? |
Comment Actions
- Set types.Config.Packages instead of overriding the package map
cmd/llgoi/llgoi.go | ||
---|---|---|
102–103 | Seems reasonable, done. |
I'd prefer if we stuck to the contract of go/types.Importer (as before), and instead just set go/types.Config.Packages to the same map each time. I understand that the package map is only read/updated by the importer currently, but I'm not sure if that's guaranteed to be the case forever. Perhaps I'm being paranoid?