On Mon, Dec 11, 2017 at 1:27 AM, Petr Shevtsov <petr.shevt...@gmail.com> wrote: > > I've spotted rather strange behavior of os.IsNotExist on Windows. > > This snippet[1] > > s := "http://example.com/" > fi, err := os.Stat(s) > if os.IsNotExist(err) { > fmt.Println("Not a file") > return > } > mode := fi.Mode() > if mode.IsRegular() { > fmt.Println("File") > } > > works perfectly on Linux but panics on Windows. > > This happens because of os.Stat returns an error "CreateFile > http://example.com/: The filename, directory name, or volume label syntax is > incorrect." (errno 123[2]) for such input, but os.IsNotExist(err) returns > false. > > Is this a bug in os.IsNotExist[3] or such behavior is intentional?
This sounds like a bug, although it may not be easy to fix. Please open an bug report at https://golang.org/issue. Thanks. Ian -- 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.