diff options
author | Rahat Mahmood <rahat@google.com> | 2020-04-01 00:42:34 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-01 00:43:55 -0700 |
commit | 507f997213d4b6778c5da982dd447044b769e7b9 (patch) | |
tree | 5da2ec5b38eb2f4fe7baf0978a00947d66754b75 /pkg/sentry | |
parent | 840980aeba0b5224b13bcaadf5785ac5305a5230 (diff) |
go-marshal: Improve collision detection of import statments.
Previously, the import statement collision detection mechanism aborted
go-marshal whenever it detected two imports in any package that has
the same local name. Consider this trivial package, defined by the the
following two source files:
file1.go:
package example
import (
path/a/to/foo
)
...
file2.go:
package example
import (
another/package/with/final/component/foo
)
...
Go-marshal previously couldn't handle generating code for the the
above package, even if none of the types marked for marshalling used
either of the imported foo packages. This turns out to be too
restrictive as we run into this a lot in practice. Examples include
"encoding/binary" vs "gvisor/pkg/binary/binary", and "sync" vs
"gvisor/pkg/sync/sync".
This change allows go-marshal to proceed with marshalling, and only
abort if the code generated by go-marshal references any such
ambiguous import names.
PiperOrigin-RevId: 304131190
Diffstat (limited to 'pkg/sentry')
0 files changed, 0 insertions, 0 deletions