-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
feat(parsing): Added encoding.TextUnmarshaler support #53
Conversation
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
env.go
Outdated
@@ -122,7 +123,7 @@ func get(field reflect.StructField) (string, error) { | |||
case "required": | |||
val, err = getRequired(key) | |||
default: | |||
err = errors.New("Env tag option " + opt + " not supported.") | |||
err = fmt.Errorf("Env tag option %q not supported.", opt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error strings should not be capitalized or end with punctuation or a newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but I didn't add them and they are all through the code so didn't want to pollute the functionality of this commit with those changes.
036d649
to
d1af6f5
Compare
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
Support arbitrary types by adding the ability to deserialize environment variables on any type that implements encoding.TextUnmarshaler. This avoids the overhead of having to write custom parser funcs. Also: * Eliminate duplicate handleStruct method. * Use fmt.Errorf instead of errors.New with concatenated strings.
d1af6f5
to
c4f2804
Compare
that's super nice! Thanks @stevenh! |
feat(parsing): Added encoding.TextUnmarshaler support
Support arbitrary types by adding the ability to deserialize environment variables on any type that implements encoding.TextUnmarshaler.
This avoids the overhead of having to write custom parser funcs.
Also: