code: func renderPatternString(pat string, sub func(name string) (string, error)) (pattern.Pattern, error) {
  	var errs errors.MultiError
  	out := placeholderRe.ReplaceAllStringFunc(pat, func(match string) string {
  		name := match[2 : len(match)-1] // strip ${...}
  		val, err := sub(name)
  		if err != nil {
  			errs = append(errs, err)
  		}
  		return val
  	})
  	if len(errs) != 0 {
  		return nil, errs
  	}
  	return pattern.Parse(out)
  }
docs: // renderPatternString substitutes all ${name} placeholders via given callback
  // and compiles the resulting pattern.