code: func translate(pat string) (string, error) {
  	res := "^"
  	for _, runeVal := range pat {
  		switch runeVal {
  		case '\n':
  			return "", fmt.Errorf("new lines are not supported in globs")
  		case '*':
  			res += ".*"
  		default:
  			res += regexp.QuoteMeta(string(runeVal))
  		}
  	}
  	return res + "$", nil
  }
docs: // translate converts glob pattern to a regular expression string.