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

net: document potential values for the "Op" in net.OpError #36703

Open
kevinburkemeter opened this issue Jan 23, 2020 · 3 comments
Open

net: document potential values for the "Op" in net.OpError #36703

kevinburkemeter opened this issue Jan 23, 2020 · 3 comments

Comments

@kevinburkemeter
Copy link

@kevinburkemeter kevinburkemeter commented Jan 23, 2020

The current documentation reads:

// OpError is the error type usually returned by functions in the 
// net package. It describes the operation, network type, and address of an error.

type OpError struct {
    // Op is the operation which caused the error, such as
    // "read" or "write".
    Op string

As far as I am aware the only way to determine which "Op"'s exist is by grepping the source code of the net package.

In particular I am interested in determining whether an error with an Op value of "dial" could have ever been returned after a client sent bytes of a request to a remote HTTP server.

@kevinburkemeter
Copy link
Author

@kevinburkemeter kevinburkemeter commented Jan 23, 2020

Here's the list of Op values that I can find in the net package, assuming that nothing outside of src/net generates a *net.OpError.

$ ag 'Op:' src/net | egrep -o 'Op: "([^"]+)"' | sort | uniq
Op: "accept"
Op: "addmulti"
Op: "announce"
Op: "close"
Op: "dial"
Op: "file"
Op: "listen"
Op: "op"
Op: "proxyconnect"
Op: "raw-control"
Op: "raw-read"
Op: "raw-write"
Op: "read"
Op: "readfrom"
Op: "route"
Op: "set"
Op: "write"
Op: "writev"
Op: "wsasend"
@toothrot toothrot added this to the Backlog milestone Jan 23, 2020
@toothrot
Copy link
Contributor

@toothrot toothrot commented Jan 23, 2020

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 23, 2020

I think that before listing the various options we should rationalize them. They seem to be a mix of operations like "dial" and system calls like "wsasend". What are we trying to tell the programmer? What do we expect them to do with this information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.