Compiled Go packages are stored in Unix ar archive files, so you can extract the files within them using ar
or go tool pack x pkg.a
.
Package files contain compiled code (_go_.o
), used by the linker to build binaries, and export data (__.PKGDEF
), used by the compiler when building dependent packages. If the package contained assembly files or cgo code, there may be additional .o
files, too.
You can use golang.org/x/tools/go/gcexportdata
to read export data into a format that can be understood by go/types
.
It sounds like you've already found go tool objdump
for disassembly. You might also find go tool nm
useful for listing symbols.