8000 should throw error when invalid input · Issue #96 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

should throw error when invalid input #96

Closed

Description

@bruceauyeung

saying i have

[user1]
name=bruce
age=a30

my struct

type user struct {
    Name string
    Age int
}

when i try to

err = cfg.MapTo(u)

i expect an error is throwed out because a30 is not a valid int value, but actually go-ini didn't throw any error

Activity

  1. unknwon commented on Apr 6, 2017

    @unknwon
    Member

    Hi,

    1. This is expected behavior, currently only error that makes library impossible to continue will return an error. Other errors like type parse failure would be ignored and use zero value.
    2. I can add another method like StrictMapTo to throw error every possible error.
  2. bruceauyeung commented on Apr 7, 2017

    @bruceauyeung
    Author

    @unknwon thanks for your great work! I am expecting StrictMapTo

  3. unknwon commented on Jun 2, 2017

    @unknwon
    Member

    Hi, StrictMapTo functions/methods have been added, please update and test!

  4. bruceauyeung commented on Jun 4, 2017

    @bruceauyeung
    Author

    @unknwon tested, everything works as expected, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0