Il giorno lunedì 11 dicembre 2017 17:05:27 UTC+1, Petr Shevtsov ha scritto:
>
> Greetings, gophers!
>
> 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.
>
>
Note that your code is incorrect, since you access fi when os.Stat returns 
a non nil error.

> [...]


Manlio Perillo

-- 
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.

Reply via email to