func readAligned4(r io.Reader, sz int32) ([]byte, error) { … } func ReadELFNote(filename, name string, typ int32) ([]byte, error) { … } var elfGoNote … var elfGNUNote … // The Go build ID is stored in a note described by an ELF PT_NOTE prog // header. The caller has already opened filename, to get f, and read // at least 4 kB out, in data. func readELF(name string, f *os.File, data []byte) (buildid string, err error) { … } // The Go build ID is stored at the beginning of the Mach-O __text segment. // The caller has already opened filename, to get f, and read a few kB out, in data. // Sadly, that's not guaranteed to hold the note, because there is an arbitrary amount // of other junk placed in the file ahead of the main text. func readMacho(name string, f *os.File, data []byte) (buildid string, err error) { … }