8000 Include nested struct tail padding by dajiaohuang · Pull Request #1785 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

Include nested struct tail padding - #1785

Open
dajiaohuang wants to merge 3 commits into
dominikh:masterfrom
dajiaohuang:fix/structlayout-nested-padding
Open

dajiaohuang wants to merge 3 commits into
dominikh:masterfrom
dajiaohuang:fix/structlayout-nested-padding

Conversation

@dajiaohuang
@dajiaohuang dajiaohuang commented Oct 1, 2026 •
Copy link
Copy Markdown

The recursive layout emitter computes trailing padding as the type's size minus the last field's absolute end position. For a nested struct with nonzero base offset this omits the nested struct's tail padding from the field layout. Include base in the extent and add a regression using a zero-length array field that leaves struct tail padding.

Review update: the unrelated generic-instantiation change and its fixture were removed through a normal follow-up commit; #1764 tracks that fix separately. Current-head validation: go test ./cmd/structlayout (one test) passed; git diff --check passed. Prior validation text above is historical unless repeated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0