-
Notifications
You must be signed in to change notification settings - Fork 382
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version
1.67.0
Describe the bug
The library doesn't treat correctly slices of struct pointers
To reproduce
package main
import (
"log"
"gopkg.in/ini.v1"
)
const iniData = `[Peer]
PublicKey = pubClientKey
PresharedKey = psKey
AllowedIPs = 10.2.0.2/32,fd00:2::2/128
[Peer]
PublicKey = pubClientKey2
PresharedKey = psKey2
AllowedIPs = 10.2.0.3/32,fd00:2::3/128
`
type Peer struct {
PublicKey string
PresharedKey string
AllowedIPs []string `delim:","`
}
type Config struct {
Peers []*Peer `ini:"Peer,nonunique"`
}
func main() {
cfgFile, err := ini.LoadSources(ini.LoadOptions{AllowNonUniqueSections: true}, []byte(iniData))
if err != nil {
log.Fatal(err)
}
cfg := new(Config)
if err := cfgFile.MapTo(&cfg); err != nil {
log.Fatal(err)
}
}
Expected behavior
Should unmarshal correctly, panics instead
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working