8000 Allow embedded ; and # in values · Issue #93 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

Allow embedded ; and # in values #93

Closed

Description

@slaftos

ini file processing in windows, the embedded ; and # are valid values. Take for example an sql connect string or statement in an ini file.

Not being able to allow this makes this package difficult to use in windows environments

It appears that all that would be required is to condition this block of code

	i := strings.IndexAny(line, "#;")
	if i > -1 {
		p.comment.WriteString(line[i:])
		line = strings.TrimSpace(line[:i])
	}

beginning at line 228 in parser.go

Activity

  1. changed the title [-]request a reopen of #90 Allow embedded ; and # in values[/-] [+]Allow embedded ; and # in values[/+] on Mar 15, 2017
  2. unknwon commented on Mar 15, 2017

    @unknwon
    Member

    Will add an option for this.

  3. unknwon commented on Mar 15, 2017

    @unknwon
    Member

    See usage:

    ini/ini_test.go

    Line 211 in 1730955

    cfg, err := LoadSources(LoadOptions{IgnoreInlineComment: true}, []byte(`key1=value ;comment

  4. slaftos commented on Mar 15, 2017

    @slaftos
    Author

    Works as advertised!
    thank you

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0