Skip to content

using []string in a struct goes wrong if any of the strings contains a comma ',' #348

Open
@mark-summerfield

Description

@mark-summerfield

Version

go version go1.21.4 linux/amd64

Describe the bug

I have a struct:

type Config struct {
	Scale    float32
	History  []string
}

This normally works fine with ini.ReflectFrom and ini.Load. However if one of the strings has a comma ',' it doesn't work correctly.

To reproduce

Try a .ini file like this:

Scale = 1.5
History = Test One,Test Two,Test with comma, Three,Test Four

Expected behavior

I expect it to quote commas on save and unquote them on load.

Additional context

No response

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions