Skip to content

Feature Request: Consider mitigating possiblity of calling Process with envconfig.Config as argument. #108

Closed
@pdewilde

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:

  1. Add a guard clause to Process which will return an error or panic in the case that it is called with *envconfig.Config for i. There is no reason I can think of a user would intentionally call Process with config, so I think failing is a reasonable course of action.
  2. Convert calls of Process with a *envconfig.Config into an equivalent ProcessWith call. The main issue here is dealing with the mus ... which could be done by adding any Mutators in the vararg to the Config provided, but the behavior may be somewhat unexpected.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions