From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Go buildinfo" |
|---|
| claim | "Layout of the 32-byte build-info header: magic[14], ptrSize, flags, then versPtr and modPtr. ptrSize, versPtr and modPtr are used only in the pointer form (flags bit 1 clear, before Go 1.18); flags bit 0 gives the pointer endianness (1 = big). In the inline form (flags bit 1 set, Go 1.18+) the 32-byte header is followed by two uvarint-length-prefixed strings, Go version then module info, and bytes 16-31 are unused." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Go buildinfo" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "GoBuildInfoHeader" |
|---|
| size | 32 |
|---|
| fields | | offset | 0 |
|---|
| size | 14 |
|---|
| name | "magic" |
|---|
| type | "char[14]" |
|---|
| note | ""\xff Go buildinf:"" |
|---|
|
| offset | 14 |
|---|
| size | 1 |
|---|
| name | "ptrSize" |
|---|
| type | "uint8" |
|---|
| note | "pointer form only (flags bit 1 clear)" |
|---|
|
| offset | 15 |
|---|
| size | 1 |
|---|
| name | "flags" |
|---|
| type | "uint8" |
|---|
| note | "bit 0 endianness of the pointers (1 big), bit 1 inline strings (set since Go 1.18)" |
|---|
|
| offset | 16 |
|---|
| size | 8 |
|---|
| name | "versPtr" |
|---|
| type | "uintptr" |
|---|
| note | "pointer form only; size is ptrSize (4 or 8), pointer to a Go string header" |
|---|
|
| offset | 24 |
|---|
| size | 8 |
|---|
| name | "modPtr" |
|---|
| type | "uintptr" |
|---|
| note | "pointer form only; at 16+ptrSize" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "The comment above the decoder gives the buildInfoHeader struct; versPtr/modPtr are only read when flags version bit is flagsVersionPtr; versPtr and modPtr offsets are 16 and 16+ptrSize (shown for ptrSize 8)" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/debug/buildinfo/buildinfo.go" |
|---|
| lines | "195-232" |
|---|
|
| type | "source" |
|---|
| detail | "Constants flagsEndianMask/flagsVersionMask/flagsVersionInl and the comment before 'flags := header[flagsOffset]': in the inline form the header is followed by varint-prefixed version then modinfo strings; ptrSize and the pointers are used only for flagsVersionPtr." |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/debug/buildinfo/buildinfo.go" |
|---|
| lines | "195-232" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Header layout" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T06:07:45.410Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T07:51:35.151Z" |
|---|
| summary | "Add the conditions the source states: ptrSize/versPtr/modPtr exist only in the pre-1.18 pointer form (flags bit 1 clear), flags bit 0 is the pointer endianness, pointer size is ptrSize." |
|---|
| changed | | "claim" |
| "data" |
| "evidence" |
|
|---|
|
|
|---|