Standard library / io/fs
fs.PathError
Structured operation, path and underlying error; use errors.Is and errors.As rather than comparing strings. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type PathError struct { Op string Path string Err error}Working Example
Example Snippetgo
package main
import ( "errors" "fmt" "io/fs")
func main() { e := &fs.PathError{Op: "open", Path: "x", Err: fs.ErrNotExist} fmt.Println(errors.Is(e, fs.ErrNotExist))}