in variables.go [164:188]
func (r *reference) resolve(cfg *Config, opts *options) (value, error) {
v, err := r.resolveRef(cfg, opts)
if v != nil || criticalResolveError(err) {
return v, err
}
previousErr := err
s, _, err := r.resolveEnv(cfg, opts)
if err != nil {
// TODO(ph): Not everything is an Error, will do some cleanup in another PR.
if v, ok := previousErr.(Error); ok {
if v.Reason() == ErrCyclicReference {
return nil, previousErr
}
}
return nil, err
}
if s == "" {
return nil, nil
}
return newString(context{field: r.Path.String()}, nil, s), nil
}