go/gcimporter15: update to match latest changes to cmd/compiler exporter
Backport of https://go-review.googlesource.com/27814 changes to
bexport.go.
With this, the gcimporter15 is again up-to-date and in sync with both
the compiler's export code, and the compiler's and std lib gcimporter's
import code.
Change-Id: I8e229660eb78ddc1506b7b96a89c81ff083e0412
Reviewed-on: https://go-review.googlesource.com/27914
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
diff --git a/go/gcimporter15/bexport.go b/go/gcimporter15/bexport.go
index 9208367..fc569e4 100644
--- a/go/gcimporter15/bexport.go
+++ b/go/gcimporter15/bexport.go
@@ -40,9 +40,8 @@
// If trace is set, debugging output is printed to std out.
const trace = false // default: false
-// Current export format version.
-// Must not start with 'c' or 'd' (initials of prior format).
-const exportVersion = "version 1"
+// Current export format version. Increase with each format change.
+const exportVersion = 1
// trackAllTypes enables cycle tracking for all types, not just named
// types. The existing compiler invariants assume that unnamed types
@@ -86,7 +85,10 @@
}
// write version info
- p.rawStringln(exportVersion)
+ // The version string must start with "version %d" where %d is the version
+ // number. Additional debugging information may follow after a blank; that
+ // text is ignored by the importer.
+ p.rawStringln(fmt.Sprintf("version %d", exportVersion))
var debug string
if debugFormat {
debug = "debug"