Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
wbhob opened this issue Oct 1, 2024 · 0 comments
Open
1 task done

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

wbhob opened this issue Oct 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wbhob
Copy link

wbhob commented Oct 1, 2024

Version

v1.67.0

Describe the bug

If a section key contains a : symbol and you try to deserialize from a struct, the resulting key in the ini file is wrapped in backticks (`). My use case is that I am programmatically editing a Samba configuration file, and I do not have control over the definitions.

To reproduce

type Global struct {
	VfsObjects             string `ini:"vfs objects"`            
	FruitMetadata          string `ini:"fruit:metadata"`     
}

var path = "/etc/samba/smb.conf"

func main()  {
	global := &Global{
		VfsObjects:    "catia fruit streams_xattr",
		FruitMetadata: "stream",
	}
        file, _ := ini.Load(path)
        file.Section("global").ReflectFrom(global)
        file.Save(path)
}

cating the path prints:

[global]
vfs objects      = catia fruit streams_xattr
`fruit:metadata` = stream

Expected behavior

I would expect it to write:

[global]
vfs objects    = catia fruit streams_xattr
fruit:metadata = stream

Additional context

Here's more information about Samba and the Smb Conf file: https://www.samba.org/samba/docs/4.9/man-html/smb.conf.5.html

Code of Conduct

  • I agree to follow this project's Code of Conduct
@wbhob wbhob added the bug Something isn't working label Oct 1, 2024
@wbhob wbhob changed the title ini keys with : in the key name get wrapped in backticks (\`) ini keys with : in the key name get wrapped in backticks (`) Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@wbhob and others