const DefaultFileContentType = "application/octet-stream"

func ContainsString

func ContainsString(list []string, target string) bool

func ContentTypeByFilename

func ContentTypeByFilename(filename string) string

Returns a MIME content type based on the filename's extension. If no appropriate one is found, returns "application/octet-stream" by default. Additionally, specifies the charset as UTF-8 for text/* types.

func DirExists

func DirExists(filename string) bool

DirExists returns true if the given path exists and is a directory.

func Equal

func Equal(a, b interface{}) bool

Equal is a helper for comparing value equality, following these rules:

- Values with equivalent types are compared with reflect.DeepEqual
- int, uint, and float values are compared without regard to the type width.
  for example, Equal(int32(5), int64(5)) == true
- strings and byte slices are converted to strings before comparison.
- else, return false.

func ExecuteTemplate

func ExecuteTemplate(tmpl ExecutableTemplate, data interface{}) string

Execute a template and returns the result as a string.

func FindMethod

func FindMethod(recvType reflect.Type, funcVal reflect.Value) *reflect.Method

Return the reflect.Method, given a Receiver type and Func value.

func FirstNonEmpty

func FirstNonEmpty(strs ...string) string

func LoadMimeConfig

func LoadMimeConfig()

Load mime-types.conf on init.

func MustReadLines

func MustReadLines(filename string) []string

Reads the lines of the given file. Panics in the case of error.

func ParseKeyValueCookie

func ParseKeyValueCookie(val string, cb func(key, val string))

Takes the raw (escaped) cookie value and parses out key values.

func ReadLines

func ReadLines(filename string) ([]string, error)

Reads the lines of the given file. Panics in the case of error.

type ExecutableTemplate

type ExecutableTemplate interface {
    Execute(io.Writer, interface{}) error

Add some more methods to the default Template.