Skip to content

Error: pointer slices not recognized #371

@DeadLockStarve

Description

@DeadLockStarve

Version

1.67.0

Describe the bug

Parser doesn't recognize pointer slices, fails with unsupported type: []ptr

To reproduce

package main

import (
	"log"

	"gopkg.in/ini.v1"
)

const iniData = `user=foo
user=bar
user=baz
`

type Config struct {
	Users []*string `ini:"user,allowshadow"`
}

func main() {
	cfgFile, err := ini.LoadSources(ini.LoadOptions{AllowShadows: true}, []byte(iniData))
	if err != nil {
		log.Fatal(err)
	}

	cfg := new(Config)
	if err := cfgFile.MapTo(&cfg); err != nil {
		log.Fatal(err)
	}
}

Expected behavior

Correctly unmarshal into []*string

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