Open
Description
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)
}
cat
ing 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
Activity