type PackageInit … type InitData … // Locate the file from which to read export data. // This is intended to replicate the logic in gofrontend. func findExportFile(searchpaths []string, pkgpath string) (string, error) { … } const gccgov1Magic … const gccgov2Magic … const gccgov3Magic … const goimporterMagic … const archiveMagic … // Opens the export data file at the given path. If this is an ELF file, // searches for and opens the .go_export section. If this is an archive, // reads the export data from the first member, which is assumed to be an ELF file. // This is intended to replicate the logic in gofrontend. func openExportFile(fpath string) (reader io.ReadSeeker, closer io.Closer, err error) { … } type Importer … func GetImporter(searchpaths []string, initmap map[*types.Package]InitData) Importer { … } // readMagic reads the four bytes at the start of a ReadSeeker and // returns them as a string. func readMagic(reader io.ReadSeeker) (string, error) { … }