code: func subVars(s string, vars map[string]string) (string, error) {
  	var badKeys []string
  	res := subVarsRe.ReplaceAllStringFunc(s, func(match string) string {
  		// Strip '${' and '}'.
  		key := match[2 : len(match)-1]
  		val, ok := vars[key]
  		if !ok {
  			badKeys = append(badKeys, key)
  			return match
  		}
  		return val
  	})
  	if len(badKeys) != 0 {
  		return res, fmt.Errorf("values for some variables are not provided: %v", badKeys)
  	}
  	return res, nil
  }
docs: // subVars replaces "${key}" in strings with values from 'vars' map. Returns
  // error if some keys weren't found in 'vars' map.