Skip to content

file: quote keys using the write delimiter - #397

Closed
team-humaki wants to merge 1 commit into
go-ini:v1from
team-humaki:write-colon-key-no-backticks
Closed

team-humaki wants to merge 1 commit into
go-ini:v1from
team-humaki:write-colon-key-no-backticks

Conversation

@team-humaki

Copy link
Copy Markdown

Keys were quoted whenever they contained any parse-time delimiter (KeyValueDelimiters, default =:). That wraps Samba-style names like fruit:metadata in backticks even though the write delimiter is =.

Quote a key only if it contains the write delimiter or a double quote (or wrap keys that themselves contain backticks). = in a key is still quoted.

Fixes #355

Do not wrap key names in backticks just because they contain a
parse-time extra delimiter such as ':'. Samba-style keys like
fruit:metadata are valid when the write delimiter is '='.

Fixes go-ini#355

unknwon commented Nov 11, 2026

Copy link
Copy Markdown
Member

Thanks for looking into issue 355. Key quoting has to follow KeyValueDelimiters, because the reader splits an unquoted key there. With default options, fruit:metadata = v would read back as the key fruit. Loading with KeyValueDelimiters: "=" already writes such keys without backticks, and they read back correctly.

@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.

ini keys with : in the key name get wrapped in backticks (`)

2 participants