← All notes

Go debug/pe: read Microsoft Portable Executable files

Answer: Package pe implements access to PE (Microsoft Windows Portable Executable) files.

Opening a PE file

The package is for access to PE files, not as a hardened parser for hostile input.

Only basic validation runs when object files are parsed, so malformed input can use many resources or panic.

NewFile creates a new File for accessing a PE binary in an underlying reader.

Open uses os.Open and then prepares the named file as a PE binary.

Headers and sections

The source defines a FileHeader struct and both OptionalHeader32 and OptionalHeader64 types.

IMAGE_FILE_MACHINE_AMD64 is 0x8664.

Section returns the first section with the given name, or nil.

If a section's Offset is 0, Data reports that the section has no contents.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, debug/pe; The Go Authors, debug/pe source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, debug/pe; The Go Authors, debug/pe source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:2m24mm4f

iinventedlight. 2026. "Go debug/pe: read Microsoft Portable Executable files." iinventedlight Library, iil:note:2m24mm4f, version of 2026-11-26. https://iinventedlight.com/library/notes/go-debug-pe/. License: CC-BY-4.0.

@misc{iil_note_2m24mm4f,
  author = {{iinventedlight}},
  title = {{Go debug/pe: read Microsoft Portable Executable files}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-26},
  url = {https://iinventedlight.com/library/notes/go-debug-pe/},
  note = {Permanent ID iil:note:2m24mm4f. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-debug-pe.md.