Skip to content

Conversation

@wfernandes
Copy link

If we have a prefix called "env_config" and the following struct tags
for property "Foo", we should expect to see an error message stating
that the required env var "ENV_CONFIG_BAR" is missing and not just
"BAR" since that is the env var being looked up.

type Spec struct {
  Foo string `envconfig:"bar" required:"true"`
}

Fixes #199

If we have a prefix called "env_config" and the following struct tags
for property "Foo", we should expect to see an error message stating
that the required env var "ENV_CONFIG_BAR" is missing and not just
"BAR" since that is the env var being looked up.

```
type Spec struct {
  Foo string `envconfig:"bar" required:"true"`
}
```
@mgerasimchuk
Copy link

@kelseyhightower please have a look

also faced this problem and @wfernandes solution works totally well for me

Would be great to merge it

@sakhdevel
Copy link

Is this the end?

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 this pull request may close these issues.

Error message from required field should include prefix if specified.

4 participants