Skip to content

parser: keep trailing comments after last section - #401

Merged
unknwon merged 2 commits into
go-ini:v1from
team-humaki:preserve-eof-section-comments
Nov 11, 2026
Merged

unknwon merged 2 commits into
go-ini:v1from
team-humaki:preserve-eof-section-comments

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #362.

Comments after the last key of the last section were dropped on EOF, so rewriting a file (or adding a new section) stripped Ansible blockinfile # END markers.

Store those leftover comments on the last section as TrailingComment and write them after its keys so round-trip preserves the marker.

@unknwon
unknwon merged commit 5213cac into go-ini:v1 Nov 11, 2026
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.

Parser removes ansible like comments

2 participants