dirname

dirname

[code=golang]
package main 

import (
   "fmt"
   "path/filepath"
)

func main() {
   dir := filepath.Dir("/foo/bar/baz")

   // Prints: /foo/bar
   fmt.Print(dir)                     
}
[/code]