code: func (r *RuleSet) RegisterVar(name string, value func(context.Context) (string, error)) {
  	r.l.Lock()
  	defer r.l.Unlock()
  	if r.v == nil {
  		r.v = make(map[string]func(context.Context) (string, error), 1)
  	}
  	if r.v[name] != nil {
  		panic(fmt.Sprintf("variable %q is already registered", name))
  	}
  	r.v[name] = value
  }
docs: // RegisterVar registers a placeholder that can be used in patterns as ${name}.
  //
  // Such placeholder is rendered into an actual value via the given callback
  // before the validation starts. The value of the placeholder is injected into
  // the pattern string as is. So for example if the pattern is 'regex:...',
  // the placeholder value can be a chunk of regexp.
  //
  // The primary use case for this mechanism is too allow to register rule
  // patterns that depend on not-yet known values during init() time.
  //
  // Panics if such variable is already registered.