Netflix/go-env

Proposal: validation API, which do not stop on first error

Opened this issue · 0 comments

slsyy commented

Currently Unmarshal return error as soon as it is possible, which means that in the case of invalid env configuration we need to check it in a loop:

  1. Check error message about one value
  2. Fix one value
  3. Check error message about another one value
  4. GOTO 2

I propose new alternatives for UnmarshalFromEnviron and Unmarshal to the API, which will return error of that type:

type ErrValidation struct {
    Errors map[string]error
}

So I know exactly what is wrong in the configuration