mime.go
func (mr *Reader) Get(ext string) string {
	var err error
	// No extension
	if len(ext) == 0 {
		return ""
	}
	// Strip the leading dot
	if ext[0] == '.' {
		ext = ext[1:]
	}
	mr.mu.Lock()
	defer mr.mu.Unlock()
	if mr.mimetypes == nil {
		mr.mimetypes, err = readMimetypes(mr.filename)
		if err != nil {
			// Using the fallback hash map
			if mime, ok := fallback[ext]; ok {
				return mime
			}
			// Unable to find the mime type for the given extension
			return ""
		}
	}
	// Use the value from the hash map
	if mime, ok := mr.mimetypes[ext]; ok {
		return mime
	}
	// Using the fallback hash map
	if mime, ok := fallback[ext]; ok {
		return mime
	}
	// Unable to find the mime type for the given extension
	return ""
}
func (mr *Reader) Get(ext string) string {
	var err error
	// No extension
	if len(ext) == 0 {
		return ""
	}
	// Strip the leading dot
	if ext[0] == '.' {
		ext = ext[1:]
	}
	mr.mu.Lock()
	defer mr.mu.Unlock()
	if mr.mimetypes == nil {
		mr.mimetypes, err = readMimetypes(mr.filename)
		if err != nil {
			// Using the fallback hash map
			if mime, ok := fallback[ext]; ok {
				return mime
			}
			// Unable to find the mime type for the given extension
			return ""
		}
	}
	// Use the value from the hash map
	if mime, ok := mr.mimetypes[ext]; ok {
		return mime
	}
	// Using the fallback hash map
	if mime, ok := fallback[ext]; ok {
		return mime
	}
	// Unable to find the mime type for the given extension
	return ""
}
func ( mr * Reader ) Get ( ext string ) string { var err error // No extension if len ( ext ) == 0 { return " " } // Strip the leading dot if ext [ 0 ] == '.' { ext = ext [ 1 : ] } mr . mu . Lock ( ) defer mr . mu . Unlock ( ) if mr . mimetypes == nil { mr . mimetypes , err = readMimetypes ( mr . filename ) if err != nil { // Using the fallback hash map if mime , ok := fallback [ ext ] ; ok { return mime } // Unable to find the mime type for the given extension return " " } } // Use the value from the hash map if mime , ok := mr . mimetypes [ ext ] ; ok { return mime } // Using the fallback hash map if mime , ok := fallback [ ext ] ; ok { return mime } // Unable to find the mime type for the given extension return " " }
// Get returns the mimetype, or an empty string if no mimetype or mimetype source is found
Get returns the mimetype or an empty string if no mimetype or mimetype source is found