Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: document form of returned errors #2383

Closed
bradfitz opened this issue Oct 18, 2011 · 8 comments
Closed

os: document form of returned errors #2383

bradfitz opened this issue Oct 18, 2011 · 8 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Milestone

Comments

@bradfitz
Copy link
Contributor

As a newcomer to Go, I remember struggling with trying to find os.ENOENT, buried in a
PathError, buried in an os.Error.  This keeps coming up on the list too.

The docs don't even say what type of errors Open or Stat might return:

http://golang.org/pkg/os/#File.Open
http://golang.org/pkg/os/#File.Stat

(I remember first going on a mission to find a pretty printing function, eventually
finding fmt %T and %#v)

It might be worth calling out at least os.PathError there, and perhaps something like
"If the file doesn't exist, the returned error will be of type *os.PathError, with
a PathError.Error value of ENOENT".
@rsc
Copy link
Contributor

rsc commented Oct 18, 2011

Comment 1:

Owner changed to @rsc.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 2:

Labels changed: added priority-later.

@rsc
Copy link
Contributor

rsc commented Dec 12, 2011

Comment 3:

Labels changed: added priority-go1.

@hanwen
Copy link
Contributor

hanwen commented Dec 14, 2011

Comment 4:

For writing go-fuse I only need the errno error, since that is the only I can pass back.
I ended up writing a function that tries to unpack the various errors and extract the
error number.  It's fragile though, since it depends on what error types the os package
creates.  
I would very much welcome something that converts os errors to either an errno int
(preferred) or a syscall.Errno error.

@bradfitz
Copy link
Contributor Author

Comment 5:

Re comment #4, that's going the wrong direction, from portable to non-portable.

@robpike
Copy link
Contributor

robpike commented Jan 13, 2012

Comment 6:

Owner changed to builder@golang.org.

@rsc
Copy link
Contributor

rsc commented Jan 30, 2012

Comment 8:

Labels changed: added go1-must.

@robpike
Copy link
Contributor

robpike commented Feb 9, 2012

Comment 9:

This issue was closed by revision be0f6fe.

Status changed to Fixed.

@bradfitz bradfitz added fixed Documentation Issues describing a change to documentation. labels Feb 9, 2012
@rsc rsc added this to the Go1 milestone Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

5 participants