8000 custom delimiter of comments · Issue #350 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

custom delimiter of comments #350

Closed
Closed

Description

@kkqy

Describe the feature

I am trying parsing an nonstandard ini file that contains some nonstandard comments like:

\\This is a section
[Section]
name=tool

But it return an error :
key-value delimiter not found: \\This is a section

Describe the solution you'd like

I want to have an option that can custom the delimiter of comments.

Describe alternatives you've considered

I checked the document and find that we can custom delimiter of key-value, so I think it shoulds can custom a delimiter of comments too.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    feature
    on Mar 16, 2024
  2. unknwon commented on Nov 11, 2026

    @unknwon
    Member

    v2 adds the CommentSymbols load option, which sets the characters that start a comment line. Your file loads with:

    f, err := ini.Load(data, ini.CommentSymbols(`\`))

    name reads as tool, and the \\This is a section line is kept as the section's comment. Pass several characters, e.g., ini.CommentSymbols(";#\\"), to accept more than one.

    Available in unknwon.dev/ini/v2, v2.0.0-beta.1 and later. See the migration guide to move from v1.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0