On Mon, Dec 11, 2017 at 1:27 AM, Petr Shevtsov <
petr.s...@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
. Thanks.