Commit 357296a7 authored by Dmitri Shuralyov's avatar Dmitri Shuralyov Committed by Brad Fitzpatrick

all: single space after period

The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions, and changes in go repository. This means
contributors won't be confused by misleading precedence.

This CL was generated with:

	perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

on top of copyright headers change in https://golang.org/cl/32878.

Follows https://golang.org/cl/20022.

Change-Id: I821e4a300122b4668aa31e12eaa914db615e5369
Reviewed-on: https://go-review.googlesource.com/32879Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent f2499483
...@@ -33,7 +33,7 @@ func canUseOSVM() bool { ...@@ -33,7 +33,7 @@ func canUseOSVM() bool {
} }
// All BPF tests against both the Go VM and OS VM are assumed to // All BPF tests against both the Go VM and OS VM are assumed to
// be used with a UDP socket. As a result, the entire contents // be used with a UDP socket. As a result, the entire contents
// of a UDP datagram is sent through the BPF program, but only // of a UDP datagram is sent through the BPF program, but only
// the body after the UDP header will ever be returned in output. // the body after the UDP header will ever be returned in output.
...@@ -85,7 +85,7 @@ func (mvm *multiVirtualMachine) Run(in []byte) (int, error) { ...@@ -85,7 +85,7 @@ func (mvm *multiVirtualMachine) Run(in []byte) (int, error) {
} }
// All tests have a UDP header as part of input, because the OS VM // All tests have a UDP header as part of input, because the OS VM
// packets always will. For the Go VM, this output is trimmed before // packets always will. For the Go VM, this output is trimmed before
// being sent back to tests. // being sent back to tests.
goOut, goErr := mvm.goVM.Run(in) goOut, goErr := mvm.goVM.Run(in)
if goOut >= udpHeaderLen { if goOut >= udpHeaderLen {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// and between processes. // and between processes.
// //
// Incoming requests to a server should create a Context, and outgoing calls to // Incoming requests to a server should create a Context, and outgoing calls to
// servers should accept a Context. The chain of function calls between must // servers should accept a Context. The chain of function calls between must
// propagate the Context, optionally replacing it with a modified copy created // propagate the Context, optionally replacing it with a modified copy created
// using WithDeadline, WithTimeout, WithCancel, or WithValue. // using WithDeadline, WithTimeout, WithCancel, or WithValue.
// //
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
// propagation: // propagation:
// //
// Do not store Contexts inside a struct type; instead, pass a Context // Do not store Contexts inside a struct type; instead, pass a Context
// explicitly to each function that needs it. The Context should be the first // explicitly to each function that needs it. The Context should be the first
// parameter, typically named ctx: // parameter, typically named ctx:
// //
// func DoSomething(ctx context.Context, arg Arg) error { // func DoSomething(ctx context.Context, arg Arg) error {
// // ... use ctx ... // // ... use ctx ...
// } // }
// //
// Do not pass a nil Context, even if a function permits it. Pass context.TODO // Do not pass a nil Context, even if a function permits it. Pass context.TODO
// if you are unsure about which Context to use. // if you are unsure about which Context to use.
// //
// Use context Values only for request-scoped data that transits processes and // Use context Values only for request-scoped data that transits processes and
...@@ -44,13 +44,13 @@ import "time" ...@@ -44,13 +44,13 @@ import "time"
// Context's methods may be called by multiple goroutines simultaneously. // Context's methods may be called by multiple goroutines simultaneously.
type Context interface { type Context interface {
// Deadline returns the time when work done on behalf of this context // Deadline returns the time when work done on behalf of this context
// should be canceled. Deadline returns ok==false when no deadline is // should be canceled. Deadline returns ok==false when no deadline is
// set. Successive calls to Deadline return the same results. // set. Successive calls to Deadline return the same results.
Deadline() (deadline time.Time, ok bool) Deadline() (deadline time.Time, ok bool)
// Done returns a channel that's closed when work done on behalf of this // Done returns a channel that's closed when work done on behalf of this
// context should be canceled. Done may return nil if this context can // context should be canceled. Done may return nil if this context can
// never be canceled. Successive calls to Done return the same value. // never be canceled. Successive calls to Done return the same value.
// //
// WithCancel arranges for Done to be closed when cancel is called; // WithCancel arranges for Done to be closed when cancel is called;
// WithDeadline arranges for Done to be closed when the deadline // WithDeadline arranges for Done to be closed when the deadline
...@@ -79,24 +79,24 @@ type Context interface { ...@@ -79,24 +79,24 @@ type Context interface {
// a Done channel for cancelation. // a Done channel for cancelation.
Done() <-chan struct{} Done() <-chan struct{}
// Err returns a non-nil error value after Done is closed. Err returns // Err returns a non-nil error value after Done is closed. Err returns
// Canceled if the context was canceled or DeadlineExceeded if the // Canceled if the context was canceled or DeadlineExceeded if the
// context's deadline passed. No other values for Err are defined. // context's deadline passed. No other values for Err are defined.
// After Done is closed, successive calls to Err return the same value. // After Done is closed, successive calls to Err return the same value.
Err() error Err() error
// Value returns the value associated with this context for key, or nil // Value returns the value associated with this context for key, or nil
// if no value is associated with key. Successive calls to Value with // if no value is associated with key. Successive calls to Value with
// the same key returns the same result. // the same key returns the same result.
// //
// Use context values only for request-scoped data that transits // Use context values only for request-scoped data that transits
// processes and API boundaries, not for passing optional parameters to // processes and API boundaries, not for passing optional parameters to
// functions. // functions.
// //
// A key identifies a specific value in a Context. Functions that wish // A key identifies a specific value in a Context. Functions that wish
// to store values in Context typically allocate a key in a global // to store values in Context typically allocate a key in a global
// variable then use that key as the argument to context.WithValue and // variable then use that key as the argument to context.WithValue and
// Context.Value. A key can be any type that supports equality; // Context.Value. A key can be any type that supports equality;
// packages should define keys as an unexported type to avoid // packages should define keys as an unexported type to avoid
// collisions. // collisions.
// //
...@@ -115,7 +115,7 @@ type Context interface { ...@@ -115,7 +115,7 @@ type Context interface {
// // This prevents collisions with keys defined in other packages. // // This prevents collisions with keys defined in other packages.
// type key int // type key int
// //
// // userKey is the key for user.User values in Contexts. It is // // userKey is the key for user.User values in Contexts. It is
// // unexported; clients use user.NewContext and user.FromContext // // unexported; clients use user.NewContext and user.FromContext
// // instead of using this key directly. // // instead of using this key directly.
// var userKey key = 0 // var userKey key = 0
...@@ -134,14 +134,14 @@ type Context interface { ...@@ -134,14 +134,14 @@ type Context interface {
} }
// Background returns a non-nil, empty Context. It is never canceled, has no // Background returns a non-nil, empty Context. It is never canceled, has no
// values, and has no deadline. It is typically used by the main function, // values, and has no deadline. It is typically used by the main function,
// initialization, and tests, and as the top-level Context for incoming // initialization, and tests, and as the top-level Context for incoming
// requests. // requests.
func Background() Context { func Background() Context {
return background return background
} }
// TODO returns a non-nil, empty Context. Code should use context.TODO when // TODO returns a non-nil, empty Context. Code should use context.TODO when
// it's unclear which Context to use or it is not yet available (because the // it's unclear which Context to use or it is not yet available (because the
// surrounding function has not yet been extended to accept a Context // surrounding function has not yet been extended to accept a Context
// parameter). TODO is recognized by static analysis tools that determine // parameter). TODO is recognized by static analysis tools that determine
......
...@@ -35,8 +35,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { ...@@ -35,8 +35,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
} }
// WithDeadline returns a copy of the parent context with the deadline adjusted // WithDeadline returns a copy of the parent context with the deadline adjusted
// to be no later than d. If the parent's deadline is already earlier than d, // to be no later than d. If the parent's deadline is already earlier than d,
// WithDeadline(parent, d) is semantically equivalent to parent. The returned // WithDeadline(parent, d) is semantically equivalent to parent. The returned
// context's Done channel is closed when the deadline expires, when the returned // context's Done channel is closed when the deadline expires, when the returned
// cancel function is called, or when the parent context's Done channel is // cancel function is called, or when the parent context's Done channel is
// closed, whichever happens first. // closed, whichever happens first.
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
"time" "time"
) )
// An emptyCtx is never canceled, has no values, and has no deadline. It is not // An emptyCtx is never canceled, has no values, and has no deadline. It is not
// struct{}, since vars of this type must have distinct addresses. // struct{}, since vars of this type must have distinct addresses.
type emptyCtx int type emptyCtx int
...@@ -104,7 +104,7 @@ func propagateCancel(parent Context, child canceler) { ...@@ -104,7 +104,7 @@ func propagateCancel(parent Context, child canceler) {
} }
// parentCancelCtx follows a chain of parent references until it finds a // parentCancelCtx follows a chain of parent references until it finds a
// *cancelCtx. This function understands how each of the concrete types in this // *cancelCtx. This function understands how each of the concrete types in this
// package represents its parent. // package represents its parent.
func parentCancelCtx(parent Context) (*cancelCtx, bool) { func parentCancelCtx(parent Context) (*cancelCtx, bool) {
for { for {
...@@ -134,14 +134,14 @@ func removeChild(parent Context, child canceler) { ...@@ -134,14 +134,14 @@ func removeChild(parent Context, child canceler) {
p.mu.Unlock() p.mu.Unlock()
} }
// A canceler is a context type that can be canceled directly. The // A canceler is a context type that can be canceled directly. The
// implementations are *cancelCtx and *timerCtx. // implementations are *cancelCtx and *timerCtx.
type canceler interface { type canceler interface {
cancel(removeFromParent bool, err error) cancel(removeFromParent bool, err error)
Done() <-chan struct{} Done() <-chan struct{}
} }
// A cancelCtx can be canceled. When canceled, it also cancels any children // A cancelCtx can be canceled. When canceled, it also cancels any children
// that implement canceler. // that implement canceler.
type cancelCtx struct { type cancelCtx struct {
Context Context
...@@ -193,8 +193,8 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) { ...@@ -193,8 +193,8 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) {
} }
// WithDeadline returns a copy of the parent context with the deadline adjusted // WithDeadline returns a copy of the parent context with the deadline adjusted
// to be no later than d. If the parent's deadline is already earlier than d, // to be no later than d. If the parent's deadline is already earlier than d,
// WithDeadline(parent, d) is semantically equivalent to parent. The returned // WithDeadline(parent, d) is semantically equivalent to parent. The returned
// context's Done channel is closed when the deadline expires, when the returned // context's Done channel is closed when the deadline expires, when the returned
// cancel function is called, or when the parent context's Done channel is // cancel function is called, or when the parent context's Done channel is
// closed, whichever happens first. // closed, whichever happens first.
...@@ -226,8 +226,8 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { ...@@ -226,8 +226,8 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
return c, func() { c.cancel(true, Canceled) } return c, func() { c.cancel(true, Canceled) }
} }
// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to // A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
// implement Done and Err. It implements cancel by stopping its timer then // implement Done and Err. It implements cancel by stopping its timer then
// delegating to cancelCtx.cancel. // delegating to cancelCtx.cancel.
type timerCtx struct { type timerCtx struct {
*cancelCtx *cancelCtx
...@@ -281,7 +281,7 @@ func WithValue(parent Context, key interface{}, val interface{}) Context { ...@@ -281,7 +281,7 @@ func WithValue(parent Context, key interface{}, val interface{}) Context {
return &valueCtx{parent, key, val} return &valueCtx{parent, key, val}
} }
// A valueCtx carries a key-value pair. It implements Value for that key and // A valueCtx carries a key-value pair. It implements Value for that key and
// delegates all other calls to the embedded Context. // delegates all other calls to the embedded Context.
type valueCtx struct { type valueCtx struct {
Context Context
......
...@@ -247,7 +247,7 @@ func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn { ...@@ -247,7 +247,7 @@ func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn {
} }
// noDialClientConnPool is an implementation of http2.ClientConnPool // noDialClientConnPool is an implementation of http2.ClientConnPool
// which never dials. We let the HTTP/1.1 client dial and use its TLS // which never dials. We let the HTTP/1.1 client dial and use its TLS
// connection instead. // connection instead.
type noDialClientConnPool struct{ *clientConnPool } type noDialClientConnPool struct{ *clientConnPool }
......
...@@ -312,7 +312,7 @@ type Framer struct { ...@@ -312,7 +312,7 @@ type Framer struct {
MaxHeaderListSize uint32 MaxHeaderListSize uint32
// TODO: track which type of frame & with which flags was sent // TODO: track which type of frame & with which flags was sent
// last. Then return an error (unless AllowIllegalWrites) if // last. Then return an error (unless AllowIllegalWrites) if
// we're in the middle of a header block and a // we're in the middle of a header block and a
// non-Continuation or Continuation on a different stream is // non-Continuation or Continuation on a different stream is
// attempted to be written. // attempted to be written.
...@@ -663,7 +663,7 @@ type SettingsFrame struct { ...@@ -663,7 +663,7 @@ type SettingsFrame struct {
func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) { func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) {
if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 { if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 {
// When this (ACK 0x1) bit is set, the payload of the // When this (ACK 0x1) bit is set, the payload of the
// SETTINGS frame MUST be empty. Receipt of a // SETTINGS frame MUST be empty. Receipt of a
// SETTINGS frame with the ACK flag set and a length // SETTINGS frame with the ACK flag set and a length
// field value other than 0 MUST be treated as a // field value other than 0 MUST be treated as a
// connection error (Section 5.4.1) of type // connection error (Section 5.4.1) of type
...@@ -672,7 +672,7 @@ func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) { ...@@ -672,7 +672,7 @@ func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) {
} }
if fh.StreamID != 0 { if fh.StreamID != 0 {
// SETTINGS frames always apply to a connection, // SETTINGS frames always apply to a connection,
// never a single stream. The stream identifier for a // never a single stream. The stream identifier for a
// SETTINGS frame MUST be zero (0x0). If an endpoint // SETTINGS frame MUST be zero (0x0). If an endpoint
// receives a SETTINGS frame whose stream identifier // receives a SETTINGS frame whose stream identifier
// field is anything other than 0x0, the endpoint MUST // field is anything other than 0x0, the endpoint MUST
...@@ -923,7 +923,7 @@ func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) { ...@@ -923,7 +923,7 @@ func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) {
FrameHeader: fh, FrameHeader: fh,
} }
if fh.StreamID == 0 { if fh.StreamID == 0 {
// HEADERS frames MUST be associated with a stream. If a HEADERS frame // HEADERS frames MUST be associated with a stream. If a HEADERS frame
// is received whose stream identifier field is 0x0, the recipient MUST // is received whose stream identifier field is 0x0, the recipient MUST
// respond with a connection error (Section 5.4.1) of type // respond with a connection error (Section 5.4.1) of type
// PROTOCOL_ERROR. // PROTOCOL_ERROR.
...@@ -1045,7 +1045,7 @@ type PriorityParam struct { ...@@ -1045,7 +1045,7 @@ type PriorityParam struct {
Exclusive bool Exclusive bool
// Weight is the stream's zero-indexed weight. It should be // Weight is the stream's zero-indexed weight. It should be
// set together with StreamDep, or neither should be set. Per // set together with StreamDep, or neither should be set. Per
// the spec, "Add one to the value to obtain a weight between // the spec, "Add one to the value to obtain a weight between
// 1 and 256." // 1 and 256."
Weight uint8 Weight uint8
......
...@@ -45,7 +45,7 @@ func NewEncoder(w io.Writer) *Encoder { ...@@ -45,7 +45,7 @@ func NewEncoder(w io.Writer) *Encoder {
// WriteField encodes f into a single Write to e's underlying Writer. // WriteField encodes f into a single Write to e's underlying Writer.
// This function may also produce bytes for "Header Table Size Update" // This function may also produce bytes for "Header Table Size Update"
// if necessary. If produced, it is done before encoding f. // if necessary. If produced, it is done before encoding f.
func (e *Encoder) WriteField(f HeaderField) error { func (e *Encoder) WriteField(f HeaderField) error {
e.buf = e.buf[:0] e.buf = e.buf[:0]
......
...@@ -61,7 +61,7 @@ func (hf HeaderField) String() string { ...@@ -61,7 +61,7 @@ func (hf HeaderField) String() string {
func (hf HeaderField) Size() uint32 { func (hf HeaderField) Size() uint32 {
// http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1
// "The size of the dynamic table is the sum of the size of // "The size of the dynamic table is the sum of the size of
// its entries. The size of an entry is the sum of its name's // its entries. The size of an entry is the sum of its name's
// length in octets (as defined in Section 5.2), its value's // length in octets (as defined in Section 5.2), its value's
// length in octets (see Section 5.2), plus 32. The size of // length in octets (see Section 5.2), plus 32. The size of
// an entry is calculated using the length of the name and // an entry is calculated using the length of the name and
...@@ -307,7 +307,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) { ...@@ -307,7 +307,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) {
err = d.parseHeaderFieldRepr() err = d.parseHeaderFieldRepr()
if err == errNeedMore { if err == errNeedMore {
// Extra paranoia, making sure saveBuf won't // Extra paranoia, making sure saveBuf won't
// get too large. All the varint and string // get too large. All the varint and string
// reading code earlier should already catch // reading code earlier should already catch
// overlong things and return ErrStringLength, // overlong things and return ErrStringLength,
// but keep this as a last resort. // but keep this as a last resort.
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"sync" "sync"
) )
// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like // pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
// io.Pipe except there are no PipeReader/PipeWriter halves, and the // io.Pipe except there are no PipeReader/PipeWriter halves, and the
// underlying buffer is an interface. (io.Pipe is always unbuffered) // underlying buffer is an interface. (io.Pipe is always unbuffered)
type pipe struct { type pipe struct {
......
...@@ -710,7 +710,7 @@ func (sc *serverConn) serve() { ...@@ -710,7 +710,7 @@ func (sc *serverConn) serve() {
return return
} }
// Now that we've got the preface, get us out of the // Now that we've got the preface, get us out of the
// "StateNew" state. We can't go directly to idle, though. // "StateNew" state. We can't go directly to idle, though.
// Active means we read some data and anticipate a request. We'll // Active means we read some data and anticipate a request. We'll
// do another Active when we get a HEADERS frame. // do another Active when we get a HEADERS frame.
sc.setConnState(http.StateActive) sc.setConnState(http.StateActive)
...@@ -2103,8 +2103,8 @@ func (b *requestBody) Read(p []byte) (n int, err error) { ...@@ -2103,8 +2103,8 @@ func (b *requestBody) Read(p []byte) (n int, err error) {
return return
} }
// responseWriter is the http.ResponseWriter implementation. It's // responseWriter is the http.ResponseWriter implementation. It's
// intentionally small (1 pointer wide) to minimize garbage. The // intentionally small (1 pointer wide) to minimize garbage. The
// responseWriterState pointer inside is zeroed at the end of a // responseWriterState pointer inside is zeroed at the end of a
// request (in handlerDone) and calls on the responseWriter thereafter // request (in handlerDone) and calls on the responseWriter thereafter
// simply crash (caller's mistake), but the much larger responseWriterState // simply crash (caller's mistake), but the much larger responseWriterState
...@@ -2278,7 +2278,7 @@ const TrailerPrefix = "Trailer:" ...@@ -2278,7 +2278,7 @@ const TrailerPrefix = "Trailer:"
// says you SHOULD (but not must) predeclare any trailers in the // says you SHOULD (but not must) predeclare any trailers in the
// header, the official ResponseWriter rules said trailers in Go must // header, the official ResponseWriter rules said trailers in Go must
// be predeclared, and then we reuse the same ResponseWriter.Header() // be predeclared, and then we reuse the same ResponseWriter.Header()
// map to mean both Headers and Trailers. When it's time to write the // map to mean both Headers and Trailers. When it's time to write the
// Trailers, we pick out the fields of Headers that were declared as // Trailers, we pick out the fields of Headers that were declared as
// trailers. That worked for a while, until we found the first major // trailers. That worked for a while, until we found the first major
// user of Trailers in the wild: gRPC (using them only over http2), // user of Trailers in the wild: gRPC (using them only over http2),
......
...@@ -318,7 +318,7 @@ func (st *serverTester) encodeHeaderRaw(headers ...string) []byte { ...@@ -318,7 +318,7 @@ func (st *serverTester) encodeHeaderRaw(headers ...string) []byte {
} }
// encodeHeader encodes headers and returns their HPACK bytes. headers // encodeHeader encodes headers and returns their HPACK bytes. headers
// must contain an even number of key/value pairs. There may be // must contain an even number of key/value pairs. There may be
// multiple pairs for keys (e.g. "cookie"). The :method, :path, and // multiple pairs for keys (e.g. "cookie"). The :method, :path, and
// :scheme headers default to GET, / and https. The :authority header // :scheme headers default to GET, / and https. The :authority header
// defaults to st.ts.Listener.Addr(). // defaults to st.ts.Listener.Addr().
...@@ -656,7 +656,7 @@ func TestServer_Request_Get_PathSlashes(t *testing.T) { ...@@ -656,7 +656,7 @@ func TestServer_Request_Get_PathSlashes(t *testing.T) {
} }
// TODO: add a test with EndStream=true on the HEADERS but setting a // TODO: add a test with EndStream=true on the HEADERS but setting a
// Content-Length anyway. Should we just omit it and force it to // Content-Length anyway. Should we just omit it and force it to
// zero? // zero?
func TestServer_Request_Post_NoContentLength_EndStream(t *testing.T) { func TestServer_Request_Post_NoContentLength_EndStream(t *testing.T) {
......
...@@ -575,7 +575,7 @@ func (cc *ClientConn) canTakeNewRequestLocked() bool { ...@@ -575,7 +575,7 @@ func (cc *ClientConn) canTakeNewRequestLocked() bool {
cc.nextStreamID < math.MaxInt32 cc.nextStreamID < math.MaxInt32
} }
// onIdleTimeout is called from a time.AfterFunc goroutine. It will // onIdleTimeout is called from a time.AfterFunc goroutine. It will
// only be called when we're idle, but because we're coming from a new // only be called when we're idle, but because we're coming from a new
// goroutine, there could be a new request coming in at the same time, // goroutine, there could be a new request coming in at the same time,
// so this simply calls the synchronized closeIfIdle to shut down this // so this simply calls the synchronized closeIfIdle to shut down this
...@@ -809,8 +809,8 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { ...@@ -809,8 +809,8 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
// 2xx, however, then assume the server DOES potentially // 2xx, however, then assume the server DOES potentially
// want our body (e.g. full-duplex streaming: // want our body (e.g. full-duplex streaming:
// golang.org/issue/13444). If it turns out the server // golang.org/issue/13444). If it turns out the server
// doesn't, they'll RST_STREAM us soon enough. This is a // doesn't, they'll RST_STREAM us soon enough. This is a
// heuristic to avoid adding knobs to Transport. Hopefully // heuristic to avoid adding knobs to Transport. Hopefully
// we can keep it. // we can keep it.
bodyWriter.cancel() bodyWriter.cancel()
cs.abortRequestBodyWrite(errStopReqBodyWrite) cs.abortRequestBodyWrite(errStopReqBodyWrite)
......
...@@ -371,7 +371,7 @@ func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observabl ...@@ -371,7 +371,7 @@ func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observabl
} }
} }
// Failed to find a level that covers the desired range. So just // Failed to find a level that covers the desired range. So just
// extract from the last level, even if it doesn't cover the entire // extract from the last level, even if it doesn't cover the entire
// desired range. // desired range.
ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results) ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// //
// The options for unicasting are available for net.TCPConn, // The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections // net.UDPConn and net.IPConn which are created as network connections
// that use the IPv4 transport. When a single TCP connection carrying // that use the IPv4 transport. When a single TCP connection carrying
// a data flow of multiple packets needs to indicate the flow is // a data flow of multiple packets needs to indicate the flow is
// important, Conn is used to set the type-of-service field on the // important, Conn is used to set the type-of-service field on the
// IPv4 header for each packet. // IPv4 header for each packet.
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
// //
// The options for multicasting are available for net.UDPConn and // The options for multicasting are available for net.UDPConn and
// net.IPconn which are created as network connections that use the // net.IPconn which are created as network connections that use the
// IPv4 transport. A few network facilities must be prepared before // IPv4 transport. A few network facilities must be prepared before
// you begin multicasting, at a minimum joining network interfaces and // you begin multicasting, at a minimum joining network interfaces and
// multicast groups. // multicast groups.
// //
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
// defer c.Close() // defer c.Close()
// //
// Second, the application joins multicast groups, starts listening to // Second, the application joins multicast groups, starts listening to
// the groups on the specified network interfaces. Note that the // the groups on the specified network interfaces. Note that the
// service port for transport layer protocol does not matter with this // service port for transport layer protocol does not matter with this
// operation as joining groups affects only network and link layer // operation as joining groups affects only network and link layer
// protocols, such as IPv4 and Ethernet. // protocols, such as IPv4 and Ethernet.
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
// } // }
// //
// The application might set per packet control message transmissions // The application might set per packet control message transmissions
// between the protocol stack within the kernel. When the application // between the protocol stack within the kernel. When the application
// needs a destination address on an incoming packet, // needs a destination address on an incoming packet,
// SetControlMessage of PacketConn is used to enable control message // SetControlMessage of PacketConn is used to enable control message
// transmissions. // transmissions.
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
// More multicasting // More multicasting
// //
// An application that uses PacketConn or RawConn may join multiple // An application that uses PacketConn or RawConn may join multiple
// multicast groups. For example, a UDP listener with port 1024 might // multicast groups. For example, a UDP listener with port 1024 might
// join two different groups across over two different network // join two different groups across over two different network
// interfaces by using: // interfaces by using:
// //
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
// } // }
// //
// It is possible for multiple UDP listeners that listen on the same // It is possible for multiple UDP listeners that listen on the same
// UDP port to join the same multicast group. The net package will // UDP port to join the same multicast group. The net package will
// provide a socket that listens to a wildcard address with reusable // provide a socket that listens to a wildcard address with reusable
// UDP port when an appropriate multicast address prefix is passed to // UDP port when an appropriate multicast address prefix is passed to
// the net.ListenPacket or net.ListenUDP. // the net.ListenPacket or net.ListenUDP.
......
...@@ -38,8 +38,8 @@ func NewConn(c net.Conn) *Conn { ...@@ -38,8 +38,8 @@ func NewConn(c net.Conn) *Conn {
} }
// A PacketConn represents a packet network endpoint that uses the // A PacketConn represents a packet network endpoint that uses the
// IPv4 transport. It is used to control several IP-level socket // IPv4 transport. It is used to control several IP-level socket
// options including multicasting. It also provides datagram based // options including multicasting. It also provides datagram based
// network I/O methods specific to the IPv4 and higher layer protocols // network I/O methods specific to the IPv4 and higher layer protocols
// such as UDP. // such as UDP.
type PacketConn struct { type PacketConn struct {
...@@ -118,8 +118,8 @@ func NewPacketConn(c net.PacketConn) *PacketConn { ...@@ -118,8 +118,8 @@ func NewPacketConn(c net.PacketConn) *PacketConn {
} }
// A RawConn represents a packet network endpoint that uses the IPv4 // A RawConn represents a packet network endpoint that uses the IPv4
// transport. It is used to control several IP-level socket options // transport. It is used to control several IP-level socket options
// including IPv4 header manipulation. It also provides datagram // including IPv4 header manipulation. It also provides datagram
// based network I/O methods specific to the IPv4 and higher layer // based network I/O methods specific to the IPv4 and higher layer
// protocols that handle IPv4 datagram directly such as OSPF, GRE. // protocols that handle IPv4 datagram directly such as OSPF, GRE.
type RawConn struct { type RawConn struct {
......
...@@ -21,7 +21,7 @@ type packetHandler struct { ...@@ -21,7 +21,7 @@ type packetHandler struct {
func (c *packetHandler) ok() bool { return c != nil && c.c != nil } func (c *packetHandler) ok() bool { return c != nil && c.c != nil }
// ReadFrom reads an IPv4 datagram from the endpoint c, copying the // ReadFrom reads an IPv4 datagram from the endpoint c, copying the
// datagram into b. It returns the received datagram as the IPv4 // datagram into b. It returns the received datagram as the IPv4
// header h, the payload p and the control message cm. // header h, the payload p and the control message cm.
func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) { func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
if !c.ok() { if !c.ok() {
...@@ -57,9 +57,9 @@ func slicePacket(b []byte) (h, p []byte, err error) { ...@@ -57,9 +57,9 @@ func slicePacket(b []byte) (h, p []byte, err error) {
} }
// WriteTo writes an IPv4 datagram through the endpoint c, copying the // WriteTo writes an IPv4 datagram through the endpoint c, copying the
// datagram from the IPv4 header h and the payload p. The control // datagram from the IPv4 header h and the payload p. The control
// message cm allows the datagram path and the outgoing interface to be // message cm allows the datagram path and the outgoing interface to be
// specified. Currently only Darwin and Linux support this. The cm // specified. Currently only Darwin and Linux support this. The cm
// may be nil if control of the outgoing datagram is not required. // may be nil if control of the outgoing datagram is not required.
// //
// The IPv4 header h must contain appropriate fields that include: // The IPv4 header h must contain appropriate fields that include:
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
) )
// ReadFrom reads a payload of the received IPv4 datagram, from the // ReadFrom reads a payload of the received IPv4 datagram, from the
// endpoint c, copying the payload into b. It returns the number of // endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address // bytes copied into b, the control message cm and the source address
// src of the received datagram. // src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
...@@ -53,10 +53,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. ...@@ -53,10 +53,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
} }
// WriteTo writes a payload of the IPv4 datagram, to the destination // WriteTo writes a payload of the IPv4 datagram, to the destination
// address dst through the endpoint c, copying the payload from b. It // address dst through the endpoint c, copying the payload from b. It
// returns the number of bytes written. The control message cm allows // returns the number of bytes written. The control message cm allows
// the datagram path and the outgoing interface to be specified. // the datagram path and the outgoing interface to be specified.
// Currently only Darwin and Linux support this. The cm may be nil if // Currently only Darwin and Linux support this. The cm may be nil if
// control of the outgoing datagram is not required. // control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() { if !c.ok() {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
) )
// ReadFrom reads a payload of the received IPv4 datagram, from the // ReadFrom reads a payload of the received IPv4 datagram, from the
// endpoint c, copying the payload into b. It returns the number of // endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address // bytes copied into b, the control message cm and the source address
// src of the received datagram. // src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
...@@ -26,10 +26,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. ...@@ -26,10 +26,10 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
} }
// WriteTo writes a payload of the IPv4 datagram, to the destination // WriteTo writes a payload of the IPv4 datagram, to the destination
// address dst through the endpoint c, copying the payload from b. It // address dst through the endpoint c, copying the payload from b. It
// returns the number of bytes written. The control message cm allows // returns the number of bytes written. The control message cm allows
// the datagram path and the outgoing interface to be specified. // the datagram path and the outgoing interface to be specified.
// Currently only Darwin and Linux support this. The cm may be nil if // Currently only Darwin and Linux support this. The cm may be nil if
// control of the outgoing datagram is not required. // control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() { if !c.ok() {
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
) )
// Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the // Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the
// former still support RFC 2292 only. Please be aware that almost // former still support RFC 2292 only. Please be aware that almost
// all protocol implementations prohibit using a combination of RFC // all protocol implementations prohibit using a combination of RFC
// 2292 and RFC 3542 for some practical reasons. // 2292 and RFC 3542 for some practical reasons.
......
...@@ -227,7 +227,7 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source ...@@ -227,7 +227,7 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source
} }
// Checksum reports whether the kernel will compute, store or verify a // Checksum reports whether the kernel will compute, store or verify a
// checksum for both incoming and outgoing packets. If on is true, it // checksum for both incoming and outgoing packets. If on is true, it
// returns an offset in bytes into the data of where the checksum // returns an offset in bytes into the data of where the checksum
// field is located. // field is located.
func (c *dgramOpt) Checksum() (on bool, offset int, err error) { func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
...@@ -248,7 +248,7 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) { ...@@ -248,7 +248,7 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
return true, offset, nil return true, offset, nil
} }
// SetChecksum enables the kernel checksum processing. If on is ture, // SetChecksum enables the kernel checksum processing. If on is ture,
// the offset should be an offset in bytes into the data of where the // the offset should be an offset in bytes into the data of where the
// checksum field is located. // checksum field is located.
func (c *dgramOpt) SetChecksum(on bool, offset int) error { func (c *dgramOpt) SetChecksum(on bool, offset int) error {
......
...@@ -94,14 +94,14 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source ...@@ -94,14 +94,14 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source
} }
// Checksum reports whether the kernel will compute, store or verify a // Checksum reports whether the kernel will compute, store or verify a
// checksum for both incoming and outgoing packets. If on is true, it // checksum for both incoming and outgoing packets. If on is true, it
// returns an offset in bytes into the data of where the checksum // returns an offset in bytes into the data of where the checksum
// field is located. // field is located.
func (c *dgramOpt) Checksum() (on bool, offset int, err error) { func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
return false, 0, errOpNoSupport return false, 0, errOpNoSupport
} }
// SetChecksum enables the kernel checksum processing. If on is ture, // SetChecksum enables the kernel checksum processing. If on is ture,
// the offset should be an offset in bytes into the data of where the // the offset should be an offset in bytes into the data of where the
// checksum field is located. // checksum field is located.
func (c *dgramOpt) SetChecksum(on bool, offset int) error { func (c *dgramOpt) SetChecksum(on bool, offset int) error {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
// //
// The options for unicasting are available for net.TCPConn, // The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections // net.UDPConn and net.IPConn which are created as network connections
// that use the IPv6 transport. When a single TCP connection carrying // that use the IPv6 transport. When a single TCP connection carrying
// a data flow of multiple packets needs to indicate the flow is // a data flow of multiple packets needs to indicate the flow is
// important, Conn is used to set the traffic class field on the IPv6 // important, Conn is used to set the traffic class field on the IPv6
// header for each packet. // header for each packet.
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
// //
// The options for multicasting are available for net.UDPConn and // The options for multicasting are available for net.UDPConn and
// net.IPconn which are created as network connections that use the // net.IPconn which are created as network connections that use the
// IPv6 transport. A few network facilities must be prepared before // IPv6 transport. A few network facilities must be prepared before
// you begin multicasting, at a minimum joining network interfaces and // you begin multicasting, at a minimum joining network interfaces and
// multicast groups. // multicast groups.
// //
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
// defer c.Close() // defer c.Close()
// //
// Second, the application joins multicast groups, starts listening to // Second, the application joins multicast groups, starts listening to
// the groups on the specified network interfaces. Note that the // the groups on the specified network interfaces. Note that the
// service port for transport layer protocol does not matter with this // service port for transport layer protocol does not matter with this
// operation as joining groups affects only network and link layer // operation as joining groups affects only network and link layer
// protocols, such as IPv6 and Ethernet. // protocols, such as IPv6 and Ethernet.
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
// } // }
// //
// The application might set per packet control message transmissions // The application might set per packet control message transmissions
// between the protocol stack within the kernel. When the application // between the protocol stack within the kernel. When the application
// needs a destination address on an incoming packet, // needs a destination address on an incoming packet,
// SetControlMessage of PacketConn is used to enable control message // SetControlMessage of PacketConn is used to enable control message
// transmissions. // transmissions.
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
// More multicasting // More multicasting
// //
// An application that uses PacketConn may join multiple multicast // An application that uses PacketConn may join multiple multicast
// groups. For example, a UDP listener with port 1024 might join two // groups. For example, a UDP listener with port 1024 might join two
// different groups across over two different network interfaces by // different groups across over two different network interfaces by
// using: // using:
// //
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
// } // }
// //
// It is possible for multiple UDP listeners that listen on the same // It is possible for multiple UDP listeners that listen on the same
// UDP port to join the same multicast group. The net package will // UDP port to join the same multicast group. The net package will
// provide a socket that listens to a wildcard address with reusable // provide a socket that listens to a wildcard address with reusable
// UDP port when an appropriate multicast address prefix is passed to // UDP port when an appropriate multicast address prefix is passed to
// the net.ListenPacket or net.ListenUDP. // the net.ListenPacket or net.ListenUDP.
......
...@@ -55,8 +55,8 @@ func NewConn(c net.Conn) *Conn { ...@@ -55,8 +55,8 @@ func NewConn(c net.Conn) *Conn {
} }
// A PacketConn represents a packet network endpoint that uses IPv6 // A PacketConn represents a packet network endpoint that uses IPv6
// transport. It is used to control several IP-level socket options // transport. It is used to control several IP-level socket options
// including IPv6 header manipulation. It also provides datagram // including IPv6 header manipulation. It also provides datagram
// based network I/O methods specific to the IPv6 and higher layer // based network I/O methods specific to the IPv6 and higher layer
// protocols such as OSPF, GRE, and UDP. // protocols such as OSPF, GRE, and UDP.
type PacketConn struct { type PacketConn struct {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
) )
// ReadFrom reads a payload of the received IPv6 datagram, from the // ReadFrom reads a payload of the received IPv6 datagram, from the
// endpoint c, copying the payload into b. It returns the number of // endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address // bytes copied into b, the control message cm and the source address
// src of the received datagram. // src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
...@@ -43,9 +43,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. ...@@ -43,9 +43,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
} }
// WriteTo writes a payload of the IPv6 datagram, to the destination // WriteTo writes a payload of the IPv6 datagram, to the destination
// address dst through the endpoint c, copying the payload from b. It // address dst through the endpoint c, copying the payload from b. It
// returns the number of bytes written. The control message cm allows // returns the number of bytes written. The control message cm allows
// the IPv6 header fields and the datagram path to be specified. The // the IPv6 header fields and the datagram path to be specified. The
// cm may be nil if control of the outgoing datagram is not required. // cm may be nil if control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() { if !c.ok() {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
) )
// ReadFrom reads a payload of the received IPv6 datagram, from the // ReadFrom reads a payload of the received IPv6 datagram, from the
// endpoint c, copying the payload into b. It returns the number of // endpoint c, copying the payload into b. It returns the number of
// bytes copied into b, the control message cm and the source address // bytes copied into b, the control message cm and the source address
// src of the received datagram. // src of the received datagram.
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
...@@ -26,9 +26,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net. ...@@ -26,9 +26,9 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
} }
// WriteTo writes a payload of the IPv6 datagram, to the destination // WriteTo writes a payload of the IPv6 datagram, to the destination
// address dst through the endpoint c, copying the payload from b. It // address dst through the endpoint c, copying the payload from b. It
// returns the number of bytes written. The control message cm allows // returns the number of bytes written. The control message cm allows
// the IPv6 header fields and the datagram path to be specified. The // the IPv6 header fields and the datagram path to be specified. The
// cm may be nil if control of the outgoing datagram is not required. // cm may be nil if control of the outgoing datagram is not required.
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
if !c.ok() { if !c.ok() {
......
...@@ -26,9 +26,9 @@ const ( ...@@ -26,9 +26,9 @@ const (
// //
// Marshal handles an array or slice by marshalling each of the elements. // Marshal handles an array or slice by marshalling each of the elements.
// Marshal handles a pointer by marshalling the value it points at or, if the // Marshal handles a pointer by marshalling the value it points at or, if the
// pointer is nil, by writing nothing. Marshal handles an interface value by // pointer is nil, by writing nothing. Marshal handles an interface value by
// marshalling the value it contains or, if the interface value is nil, by // marshalling the value it contains or, if the interface value is nil, by
// writing nothing. Marshal handles all other data by writing one or more XML // writing nothing. Marshal handles all other data by writing one or more XML
// elements containing the data. // elements containing the data.
// //
// The name for the XML elements is taken from, in order of preference: // The name for the XML elements is taken from, in order of preference:
...@@ -61,7 +61,7 @@ const ( ...@@ -61,7 +61,7 @@ const (
// value were part of the outer struct. // value were part of the outer struct.
// //
// If a field uses a tag "a>b>c", then the element c will be nested inside // If a field uses a tag "a>b>c", then the element c will be nested inside
// parent elements a and b. Fields that appear next to each other that name // parent elements a and b. Fields that appear next to each other that name
// the same parent will be enclosed in one XML element. // the same parent will be enclosed in one XML element.
// //
// See MarshalIndent for an example. // See MarshalIndent for an example.
...@@ -222,7 +222,7 @@ func (enc *Encoder) EncodeToken(t Token) error { ...@@ -222,7 +222,7 @@ func (enc *Encoder) EncodeToken(t Token) error {
return p.cachedWriteError() return p.cachedWriteError()
case ProcInst: case ProcInst:
// First token to be encoded which is also a ProcInst with target of xml // First token to be encoded which is also a ProcInst with target of xml
// is the xml declaration. The only ProcInst where target of xml is allowed. // is the xml declaration. The only ProcInst where target of xml is allowed.
if t.Target == "xml" && p.Buffered() != 0 { if t.Target == "xml" && p.Buffered() != 0 {
return fmt.Errorf("xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded") return fmt.Errorf("xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded")
} }
......
...@@ -27,7 +27,7 @@ import ( ...@@ -27,7 +27,7 @@ import (
// discarded. // discarded.
// //
// Because Unmarshal uses the reflect package, it can only assign // Because Unmarshal uses the reflect package, it can only assign
// to exported (upper case) fields. Unmarshal uses a case-sensitive // to exported (upper case) fields. Unmarshal uses a case-sensitive
// comparison to match XML element names to tag values and struct // comparison to match XML element names to tag values and struct
// field names. // field names.
// //
...@@ -37,7 +37,7 @@ import ( ...@@ -37,7 +37,7 @@ import (
// //
// * If the struct has a field of type []byte or string with tag // * If the struct has a field of type []byte or string with tag
// ",innerxml", Unmarshal accumulates the raw XML nested inside the // ",innerxml", Unmarshal accumulates the raw XML nested inside the
// element in that field. The rest of the rules still apply. // element in that field. The rest of the rules still apply.
// //
// * If the struct has a field named XMLName of type xml.Name, // * If the struct has a field named XMLName of type xml.Name,
// Unmarshal records the element name in that field. // Unmarshal records the element name in that field.
...@@ -59,7 +59,7 @@ import ( ...@@ -59,7 +59,7 @@ import (
// //
// * If the XML element contains comments, they are accumulated in // * If the XML element contains comments, they are accumulated in
// the first struct field that has tag ",comment". The struct // the first struct field that has tag ",comment". The struct
// field may have type []byte or string. If there is no such // field may have type []byte or string. If there is no such
// field, the comments are discarded. // field, the comments are discarded.
// //
// * If the XML element contains a sub-element whose name matches // * If the XML element contains a sub-element whose name matches
...@@ -102,7 +102,7 @@ import ( ...@@ -102,7 +102,7 @@ import (
// //
// Unmarshal maps an XML element or attribute value to an integer or // Unmarshal maps an XML element or attribute value to an integer or
// floating-point field by setting the field to the result of // floating-point field by setting the field to the result of
// interpreting the string value in decimal. There is no check for // interpreting the string value in decimal. There is no check for
// overflow. // overflow.
// //
// Unmarshal maps an XML element to an xml.Name by recording the // Unmarshal maps an XML element to an xml.Name by recording the
......
...@@ -252,7 +252,7 @@ func NewDecoder(r io.Reader) *Decoder { ...@@ -252,7 +252,7 @@ func NewDecoder(r io.Reader) *Decoder {
// //
// Slices of bytes in the returned token data refer to the // Slices of bytes in the returned token data refer to the
// parser's internal buffer and remain valid only until the next // parser's internal buffer and remain valid only until the next
// call to Token. To acquire a copy of the bytes, call CopyToken // call to Token. To acquire a copy of the bytes, call CopyToken
// or the token's Copy method. // or the token's Copy method.
// //
// Token expands self-closing elements such as <br/> // Token expands self-closing elements such as <br/>
...@@ -360,7 +360,7 @@ func (d *Decoder) switchToReader(r io.Reader) { ...@@ -360,7 +360,7 @@ func (d *Decoder) switchToReader(r io.Reader) {
} }
// Parsing state - stack holds old name space translations // Parsing state - stack holds old name space translations
// and the current set of open elements. The translations to pop when // and the current set of open elements. The translations to pop when
// ending a given tag are *below* it on the stack, which is // ending a given tag are *below* it on the stack, which is
// more work but forced on us by XML. // more work but forced on us by XML.
type stack struct { type stack struct {
...@@ -1253,7 +1253,7 @@ func isNameString(s string) bool { ...@@ -1253,7 +1253,7 @@ func isNameString(s string) bool {
// These tables were generated by cut and paste from Appendix B of // These tables were generated by cut and paste from Appendix B of
// the XML spec at http://www.xml.com/axml/testaxml.htm // the XML spec at http://www.xml.com/axml/testaxml.htm
// and then reformatting. First corresponds to (Letter | '_' | ':') // and then reformatting. First corresponds to (Letter | '_' | ':')
// and second corresponds to NameChar. // and second corresponds to NameChar.
var first = &unicode.RangeTable{ var first = &unicode.RangeTable{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment