Description
The gcexportdata package defines functions to export and import types.Package
s as binary messages. They serve two purposes:
gcexportdata.{Write,Read}
permit applications to serialize and deserialize type information. For example, gopls uses it for its index (database) of types.gcexportdata.Read
permits applications to read export data written by the Go compiler. For example, x/tools/go/packages uses this when NeedExport is set.
For (1), all that matters is that the Write and Read functions (at the exact same version) can faithfully round-trip all aspects of a types.Package; the form of the message isn't important. Currently, it uses the "indexed" (i
) form, which the compiler used prior to its support for inlining and generics. This form is obsolete within GOROOT and is mentioned only in a few stale references, including documentation at cmd/compile/internal/typecheck/iexport.go. We plan to purge GOROOT of all mention to the i
format, and move the docs to x/tools/internal.
For (2), what matters is that Read
can read export data written by supported versions of the compiler. The compiler currently uses the "unified" (u
) form. The gcexportdata package currently promises to "support[s] go1.7 export data format and all later versions". Given that almost all other promises of toolchain compatibility are limited to the last two Go releases (plus tip GOROOT), we propose to reduce Read's support window to match. (As a matter of fact, the code actually supports only as far back as go1.11.)
Metadata
Metadata
Assignees
Type
Projects
Status