1
0
mirror of https://github.com/golang/go synced 2024-10-04 17:21:20 -06:00
Commit Graph

6 Commits

Author SHA1 Message Date
Mikio Hara
055ecb7be5 net: fix inconsistent errors
These a series of changes fix inconsistent errors on the package net
APIs. Now almost all the APIs return OpError as a common error type
except Lookup, Resolve and Parse APIs. The Lookup, Resolve and Parse
APIs return more specific errors such as DNSError, AddrError or
ParseError.

An OpError may contain nested error information. For example, Dial may
return an OpError containing a DNSError, AddrError, unexposed type/value
or other package's type/value like the following:
	OpError{/* dial info */, Err: &DNSError{}}
	OpError{/* dial info */, Err: &AddrError{}}
	OpError{/* dial info */, Err: <unexposed type or value>}
	OpError{/* dial info */, Err: <other package's type or value>}

and Read and Write may return an OpError containing other OpError when
an application uses io.Copy or similar:
	OpError{/* for io.Reader */, Err: &OpError{/* for io.Writer */}}

When an endpoint is created for connection-oriented byte-stream
protocols, Read may return an io.EOF when the connection is closed by
remote endpoint.

Fixes #4856.

A series of changes:
- net: fix inconsistent error values on Dial, Listen partially
  https://go.googlesource.com/go/+/89b7c66d0d14462fd7893be4290bdfe5f9063ae1
- net: fix inconsistent error values on Read
  https://go.googlesource.com/go/+/ec1144423f45e010c72363fe59291d43214b6e31
- net: fix inconsistent error values on Write
  https://go.googlesource.com/go/+/11b5f98bf0d5eb8854f735cc332c912725070214
- net: fix inconsistent error values on Close
  https://go.googlesource.com/go/+/310db63c5bc121e7bfccb494c01a6b91a257e7fc
- net: fix inconsistent error values on Accept
  https://go.googlesource.com/go/+/4540e162b1aefda8157372764ad3d290a414ef1d
- net: fix inconsistent error values on File
  https://go.googlesource.com/go/+/885111365ba0a74421059bfbd18f4c57c1e70332
- net: fix inconsistent error values on setters
  https://go.googlesource.com/go/+/2173a27903897c481b0a0daf3ca3e0a0685701db
- net: fix inconsistent error values on Interface
  https://go.googlesource.com/go/+/456cf0f22c93e1a6654980f4a48a564555f6c8a2
- net: fix inconsistent error values on Lookup
  https://go.googlesource.com/go/+/0fc582e87942b2e52bed751b6c56660ba99e9a7d
- net: add Source field to OpError
  https://go.googlesource.com/go/+/afd2d2b6df3ebfe99faf347030f15adfdf422fa0

Change-Id: Id678e369088dc9fbe9073cfe7ff8a8754a57d61f
Reviewed-on: https://go-review.googlesource.com/9236
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-05 09:40:07 +00:00
Mikio Hara
885111365b net: fix inconsistent error values on File
This change fixes inconsistent error values on
File{Conn,Listener,PacketConn} and File method of Conn, Listener.

Updates #4856.

Change-Id: I3197b9277bef0e034427e3a44fa77523acaa2520
Reviewed-on: https://go-review.googlesource.com/9101
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-21 03:37:41 +00:00
Mikio Hara
3185cfbfbb net: rename netFD.proto to netFD.net on Plan 9
In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing #4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.

Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-17 00:09:13 +00:00
David du Colombier
3eadc59b0d net: fix typo in comment
Change-Id: I8b2063e65d3454a694a789c1682dacfe0bea2e19
Reviewed-on: https://go-review.googlesource.com/8965
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-16 18:45:05 +00:00
Mikio Hara
e16ed28707 net: remove full stack test cases for IPConn
A few packages that handle net.IPConn in golang.org/x/net sub repository
already implement full stack test cases with more coverage than the net
package. There is no need to keep duplicate code around here.

This change removes full stack test cases for IPConn that require
knowing how to speak with each of protocol stack implementation of
supported platforms.

Change-Id: I871119a9746fc6a2b997b69cfd733463558f5816
Reviewed-on: https://go-review.googlesource.com/3404
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-29 10:21:44 +00:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
2014-09-08 00:08:51 -04:00