code: func HasExtension(filename string, extensions map[string]bool) bool {
  	var ext string
  	if e := filepath.Ext(filename); strings.HasPrefix(e, ".") {
  		ext = e[1:]
  	} else {
  		return false
  	}
  
  	// Case-insensitive lookup.
  	// Optimistically assume a short ASCII extension and be
  	// allocation-free in that case.
  	var buf [10]byte
  	lower := buf[:0]
  	const utf8RuneSelf = 0x80 // from utf8 package, but not importing it.
  	for i := 0; i < len(ext); i++ {
  		c := ext[i]
  		if c >= utf8RuneSelf {
  			// Slow path.
  			return extensions[strings.ToLower(ext)]
  		}
  		if 'A' <= c && c <= 'Z' {
  			lower = append(lower, c+('a'-'A'))
  		} else {
  			lower = append(lower, c)
  		}
  	}
  	// The conversion from []byte to string doesn't allocate in
  	// a map lookup.
  	return extensions[string(lower)]
  }
docs: // HasExtension returns whether the file extension of filename is among
  // extensions. It is a case-insensitive lookup, optimized for the ASCII case.