// TODO(gri) disable and remove once there is only one export format again
const forceObjFileStability = true
-// Supported export format versions.
+// Current export format version.
// TODO(gri) Make this more systematic (issue #16244).
-const (
- exportVersion0 = "v0"
- exportVersion1 = "v1"
- exportVersion = exportVersion1
-)
+const exportVersion = "v1"
// exportInlined enables the export of inlined function bodies and related
// dependencies. The compiler should work w/o any loss of functionality with
p.paramList(sig.Recvs(), inlineable)
p.paramList(sig.Params(), inlineable)
p.paramList(sig.Results(), inlineable)
-
- // for issue #16243
- // We make this conditional for 1.7 to avoid consistency problems
- // with installed packages compiled with an older version.
- // TODO(gri) Clean up after 1.7 is out (issue #16244)
- if exportVersion == exportVersion1 {
- p.bool(m.Nointerface)
- }
+ p.bool(m.Nointerface) // record go:nointerface pragma value (see also #16243)
var f *Func
if inlineable {
// changes to bimport.go and bexport.go.
type importer struct {
- in *bufio.Reader
- buf []byte // reused for reading strings
- version string
+ in *bufio.Reader
+ buf []byte // reused for reading strings
// object lists, in order of deserialization
strList []string
// --- generic export data ---
- p.version = p.string()
- if p.version != exportVersion0 && p.version != exportVersion1 {
- Fatalf("importer: unknown export data version: %s", p.version)
+ if v := p.string(); v != exportVersion {
+ Fatalf("importer: unknown export data version: %s", v)
}
// populate typList with predeclared "known" types
recv := p.paramList() // TODO(gri) do we need a full param list for the receiver?
params := p.paramList()
result := p.paramList()
-
- nointerface := false
- if p.version == exportVersion1 {
- nointerface = p.bool()
- }
+ nointerface := p.bool()
n := methodname1(newname(sym), recv[0].Right)
n.Type = functype(recv[0], params, result)
data []byte
path string
buf []byte // for reading strings
- version string
// object lists
strList []string // in order of appearance
// --- generic export data ---
- p.version = p.string()
- if p.version != "v0" && p.version != "v1" {
- return p.read, nil, fmt.Errorf("unknown export data version: %s", p.version)
+ if v := p.string(); v != "v1" {
+ return p.read, nil, fmt.Errorf("unknown export data version: %s", v)
}
// populate typList with predeclared "known" types
recv, _ := p.paramList() // TODO(gri) do we need a full param list for the receiver?
params, isddd := p.paramList()
result, _ := p.paramList()
-
- if p.version == "v1" {
- p.int() // nointerface flag - discarded
- }
+ p.int() // go:nointerface pragma - discarded
sig := types.NewSignature(recv.At(0), params, result, isddd)
t0.AddMethod(types.NewFunc(token.NoPos, parent, name, sig))