Os.Stat reported an error under windows?

the codes of a.go, b.go and a.go in the same level directory under 1.windows are as follows:

package main

import (
    "fmt"
    "os"
)

func main() {
    fi, err := os.Stat("b.go")
    if err != nil {
        fmt.Println("err:",err)
        return
    }
    fmt.Println(fi.IsDir())
}

run, error:

err: FindFirstFile b.go: The system cannot find the file specified.
It is also executed under

linux, which is normal.
): is this bug?

Jan.09,2022

maybe your execution directory is wrong, b.go the relative path you used

Menu