func dirname(path string) string {
	leading := ""
	if strings.HasPrefix(path, "/") {
		leading = "/"
	}
	parts := strings.Split(strings.Trim(path, "/"), "/")
	if len(parts) > 1 {
		return leading + strings.Join(parts[0:len(parts)-1], "/") + "/"
	}
	return leading
}
func dirname(path string) string {
	leading := ""
	if strings.HasPrefix(path, "/") {
		leading = "/"
	}
	parts := strings.Split(strings.Trim(path, "/"), "/")
	if len(parts) > 1 {
		return leading + strings.Join(parts[0:len(parts)-1], "/") + "/"
	}
	return leading
}
func dirname ( path string ) string { leading := " " if strings . HasPrefix ( path , " " ) { leading = " " } parts := strings . Split ( strings . Trim ( path , " " ) , " " ) if len ( parts ) > 1 { return leading + strings . Join ( parts [ 0 : len ( parts ) - 1 ] , " " ) + " " } return leading }
// dirname returns the logical parent directory of the path.  This is different
// than path.Split() in that we want dirname("foo/bar/") -> "foo/", whereas
// path.Split() returns "foo/bar/".
dirname returns the logical parent directory of the path . This is different than path . Split () in that we want dirname ( foo / bar / ) - > foo / whereas path . Split () returns foo / bar / .