Skip to content

Preserve comment markers in quoted INI values - #411

Closed
rupayon123 wants to merge 1 commit into
go-ini:v1from
rupayon123:contribution/quoted-comment-markers-20260923
Closed

rupayon123 wants to merge 1 commit into
go-ini:v1from
rupayon123:contribution/quoted-comment-markers-20260923

Conversation

@rupayon123

Copy link
Copy Markdown

The INI parser currently truncates single- and double-quoted values at # or ;, so primary = '#e18477' reads back as just a quote (#393). The inline-comment scan runs before the surrounding-quote handling and treats markers inside quotes as comments.

Find inline comment markers only outside quoted text, preserving the existing SpaceBeforeInlineComment rule and leaving apostrophes inside ordinary words alone. Regression tests cover quoted color values, a URL fragment followed by a real comment, ordinary unquoted comments, the space-before option and an apostrophe control. The reproduction failed before the patch; go test -race ./..., go vet ./..., go test -cover ./... (93.7% statement coverage), gofmt and git diff --check pass after on macOS/Go 1.27.1. This is a separate clean branch from #410; it does not include that PR's change.

Prepared with OpenAI Codex assistance on behalf of rupayon123. Remote CI and independent human review are not claimed.

unknwon commented Nov 11, 2026

Copy link
Copy Markdown
Member

Thanks! PR 414 is merged for issues 393 and 328. Here a quote after a space starts quoting, so e.g., k = rock 'n roll ; c would keep ; c in the value.

@unknwon unknwon closed this 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.

2 participants