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

no errors if default value doesn't parse #7

Closed
ansel1 opened this issue Apr 5, 2018 · 1 comment · Fixed by #8
Closed

no errors if default value doesn't parse #7

ansel1 opened this issue Apr 5, 2018 · 1 comment · Fixed by #8

Comments

@ansel1
Copy link

ansel1 commented Apr 5, 2018

If the value in the default tag is not parseable as the type of the field, there is no error returned. Is this intended? For example:

type Widget struct {
  Colors []string `env:"[red,blue]"`
}

func main() {
  var c Colors
  err := defaults.Set(&c)

  fmt.Println("err: ", err) // nothing printed, no error

  fmt.Println(c.Colors) // nothing printed, tag value was not valid JSON, so parsing silently failed
}
@creasty
Copy link
Owner

creasty commented Apr 11, 2018

Fixed

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

Successfully merging a pull request may close this issue.

2 participants