code: func QuotePattern(pattern string) string {
  	any := false
  loop:
  	for _, r := range pattern {
  		switch r {
  		case '*', '?', '[', '\\':
  			any = true
  			break loop
  		}
  	}
  	if !any { // short-cut without a string copy
  		return pattern
  	}
  	var buf bytes.Buffer
  	for _, r := range pattern {
  		switch r {
  		case '*', '?', '[', '\\':
  			buf.WriteByte('\\')
  		}
  		buf.WriteRune(r)
  	}
  	return buf.String()
  }
docs: // QuotePattern returns a string that quotes all special characters in the given
  // wildcard pattern. The returned string is a pattern that matches the literal
  // string.
  //
  // For example, QuotePattern(`foo*bar?`) returns `foo\*bar\?`.