Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Output:
```
[string]: golly; err: <nil>
[int]: 123; err: <nil>
[int]: 0; err: failed to parse environment variable[GH_GETENV_TEST]: strconv.ParseInt: parsing "123s4": invalid syntax: invalid value
[int]: 0; err: failed to parse environment variable[GH_GETENV_TEST]: invalid value: strconv.ParseInt: parsing "123s4": invalid syntax
[time.Time]: 2022-01-20 00:00:00 +0000 UTC; err: <nil>
[[]float64]: [26.89 0.67]; err: <nil>
[time.Duration]: 2h35m0s; err: <nil>
Expand Down
2 changes: 1 addition & 1 deletion getenv_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func ExampleEnv() {
// Output:
// [string]: golly; err: <nil>
// [int]: 123; err: <nil>
// [int]: 0; err: failed to parse environment variable[GH_GETENV_TEST]: strconv.ParseInt: parsing "123s4": invalid syntax: invalid value
// [int]: 0; err: failed to parse environment variable[GH_GETENV_TEST]: invalid value: strconv.ParseInt: parsing "123s4": invalid syntax
// [time.Time]: 2022-01-20 00:00:00 +0000 UTC; err: <nil>
// [[]float64]: [26.89 0.67]; err: <nil>
// [time.Duration]: 2h35m0s; err: <nil>
Expand Down
2 changes: 1 addition & 1 deletion internal/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Parse[T EnvParsable](raw string, p Parameters) (T, error) {
if err := parseValue(&res, raw, p); err != nil {
var zero T

return zero, fmt.Errorf("%w: %w", err, ErrInvalidValue)
return zero, fmt.Errorf("%w: %w", ErrInvalidValue, err)
}

return res, nil
Expand Down
2 changes: 1 addition & 1 deletion option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/obalunenko/getenv/internal"
)

// Option is a contract for EnvParser parameters options.
// Option configures how Env and EnvOrDefault parse the value of a variable.
type Option interface {
// Apply applies the option to the parameters.
Apply(params *internal.Parameters)
Expand Down