In windows platform, path.Dir and path.Base can't get the correct result. The test code is like this:
func main() { filename := "F:\\Test\\conf\\rkc1" i := strings.LastIndex(filename, string(filepath.Separator)) fmt.Println("dir1:", string(filename[:i+1])) fmt.Println("base1:", string(filename[i+1:])) fmt.Println("dir2:", path.Dir(filename)) fmt.Println("base2:", path.Base(filename)) } result is : dir1: F:\Test\conf\ base1: rkc1 dir2: . base2: F:\Test\conf\rkc1 The dir2 and base2 is not correct , look into the path.Dir, the code is hard code with "/", but not filepath.Separator. Can it be considered as a bug in golang lib? -- 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.