I thought to get basename, we should use the official *path.Base* -- https://golang.org/pkg/path/#Base
However, I just found out that it is *not working under DOS* -- https://play.golang.org/p/kfr0N50JWc package main import ( "fmt" "path" ) func main() { fmt.Println(path.Base("/a/b.c")) fmt.Println(path.Base(`C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\devenv.exe`)) } The output is: b.c C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\devenv.exe What's your solution for this, that is working for both Linux and Windows? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.