Feature Request: Consider mitigating possiblity of calling Process
with envconfig.Config
as argument. #108
Closed
Description
func Process(ctx context.Context, i any, mus ...Mutator) error
and func ProcessWith(ctx context.Context, c *Config) error
have similar names and signaures, and it would be easy to accidentally call Process(ctx, *Config)
which returns no error, but will not properly fill the target the user intended.
I can think of two paths to preventing such an error:
- Add a guard clause to
Process
which will return an error or panic in the case that it is called with*envconfig.Config
fori
. There is no reason I can think of a user would intentionally callProcess
with config, so I think failing is a reasonable course of action. - Convert calls of
Process
with a*envconfig.Config
into an equivalentProcessWith
call. The main issue here is dealing with themus ...
which could be done by adding anyMutator
s in the vararg to theConfig
provided, but the behavior may be somewhat unexpected.
Metadata
Assignees
Labels
No labels