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

For array field, parser performs a partial update instead of full replacement #99

Closed
y2mao opened this issue Nov 2, 2015 · 2 comments
Closed

Comments

@y2mao
Copy link

y2mao commented Nov 2, 2015

Following code:

type Config struct {
    Hosts []string
}

func main() {
    cfg := Config{
        Hosts: []string{"aaa", "bbb"},
    }

    t := `Hosts = ["ccc"]`
    if _, err := toml.Decode(t, &cfg); err != nil {
        log.Fatal(err)
    }

    fmt.Printf("%v", cfg.Hosts)
}

Expect Result: [ccc]
Actual Result: [ccc, bbb]

It seems parser performed a partial update instead of a full replacement. Is that possible to change parser's behaviour to full replacement? Thanks!

@y2mao y2mao changed the title For array field, parser performed a partial update instead of a full replacement For array field, parser performs a partial update instead of a full replacement Nov 2, 2015
@y2mao y2mao changed the title For array field, parser performs a partial update instead of a full replacement For array field, parser performs a partial update instead of full replacement Nov 2, 2015
@y2mao
Copy link
Author

y2mao commented Nov 2, 2015

Alright, It seems like a bug. I just found the open issue here #49

@cespare
Copy link
Collaborator

cespare commented Feb 23, 2016

Fixed by #84.

@cespare cespare closed this as completed Feb 23, 2016
ebrady pushed a commit to dvln/toml that referenced this issue Oct 24, 2016
…urntSushi#103)

* Handle map[string]string and map[interface{}]interface{} input
* Handle nil values

Fixes BurntSushi#99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants