Re: [go-nuts] var errors stdlib

2024-05-10 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-05-10 at 04:24 -0700, Sebastian Bogan wrote: > Hello Everyone, > > I was wondering, what was / is the reason for exposing errors as > public vars - rather than constants? Doesn't that impose some risk? > > For example: > >   fs.ErrNotExist = errors.New("foo") >   _, err =

[go-nuts] var errors stdlib

2024-05-10 Thread Sebastian Bogan
Hello Everyone, I was wondering, what was / is the reason for exposing errors as public vars - rather than constants? Doesn't that impose some risk? For example: fs.ErrNotExist = errors.New("foo") _, err = os.ReadFile("./invalid") if !errors.Is(err, fs.ErrNotExist) { fmt.Println("is