diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-03-01 23:21:55 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-03-02 00:13:47 +0000 |
| commit | 5fea2ccc77eb50a9704fa04b7c61755fe34e1d95 (patch) | |
| tree | 00137f90183ae2a01ca42249e04e9e4dabdf6249 /src/encoding/gob | |
| parent | 8b4deb448e587802f67930b765c9598fc8cd36e5 (diff) | |
| download | go-5fea2ccc77eb50a9704fa04b7c61755fe34e1d95.tar.xz | |
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. This means contributors won't be confused by
misleading precedence.
This CL doesn't use go/doc to parse. It only addresses // comments.
It was generated with:
$ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])')
$ go test go/doc -update
Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
Reviewed-on: https://go-review.googlesource.com/20022
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/encoding/gob')
| -rw-r--r-- | src/encoding/gob/debug.go | 6 | ||||
| -rw-r--r-- | src/encoding/gob/decode.go | 18 | ||||
| -rw-r--r-- | src/encoding/gob/decoder.go | 10 | ||||
| -rw-r--r-- | src/encoding/gob/encode.go | 18 | ||||
| -rw-r--r-- | src/encoding/gob/encoder.go | 2 | ||||
| -rw-r--r-- | src/encoding/gob/encoder_test.go | 8 | ||||
| -rw-r--r-- | src/encoding/gob/error.go | 4 | ||||
| -rw-r--r-- | src/encoding/gob/example_interface_test.go | 2 | ||||
| -rw-r--r-- | src/encoding/gob/example_test.go | 2 | ||||
| -rw-r--r-- | src/encoding/gob/gobencdec_test.go | 4 | ||||
| -rw-r--r-- | src/encoding/gob/type.go | 18 |
11 files changed, 46 insertions, 46 deletions
diff --git a/src/encoding/gob/debug.go b/src/encoding/gob/debug.go index 536bbdb5ac..d69d36f516 100644 --- a/src/encoding/gob/debug.go +++ b/src/encoding/gob/debug.go @@ -7,7 +7,7 @@ package gob -// This file is not normally included in the gob package. Used only for debugging the package itself. +// This file is not normally included in the gob package. Used only for debugging the package itself. // Except for reading uints, it is an implementation of a reader that is independent of // the one implemented by Decoder. // To enable the Debug function, delete the +build ignore line above and do @@ -241,7 +241,7 @@ func (deb *debugger) delimitedMessage(indent tab) bool { // loadBlock preps us to read a message // of the length specified next in the input. It returns // the length of the block. The argument tells whether -// an EOF is acceptable now. If it is and one is found, +// an EOF is acceptable now. If it is and one is found, // the return value is negative. func (deb *debugger) loadBlock(eofOK bool) int { n64, w, err := decodeUintReader(deb.r, deb.tmp) // deb.uint64 will error at EOF @@ -339,7 +339,7 @@ func (deb *debugger) string() string { return string(b) } -// delta returns the field delta at the input point. The expect argument, +// delta returns the field delta at the input point. The expect argument, // if non-negative, identifies what the value should be. func (deb *debugger) delta(expect int) int { delta := int(deb.uint64()) diff --git a/src/encoding/gob/decode.go b/src/encoding/gob/decode.go index 3b0dca86f3..3b2249f616 100644 --- a/src/encoding/gob/decode.go +++ b/src/encoding/gob/decode.go @@ -216,10 +216,10 @@ func ignoreTwoUints(i *decInstr, state *decoderState, v reflect.Value) { } // Since the encoder writes no zeros, if we arrive at a decoder we have -// a value to extract and store. The field number has already been read +// a value to extract and store. The field number has already been read // (it's how we knew to call this decoder). // Each decoder is responsible for handling any indirections associated -// with the data structure. If any pointer so reached is nil, allocation must +// with the data structure. If any pointer so reached is nil, allocation must // be done. // decAlloc takes a value and returns a settable value that can @@ -308,9 +308,9 @@ func decUint64(i *decInstr, state *decoderState, value reflect.Value) { } // Floating-point numbers are transmitted as uint64s holding the bits -// of the underlying representation. They are sent byte-reversed, with +// of the underlying representation. They are sent byte-reversed, with // the exponent end coming out first, so integer floating point numbers -// (for example) transmit more compactly. This routine does the +// (for example) transmit more compactly. This routine does the // unswizzling. func float64FromBits(u uint64) float64 { var v uint64 @@ -332,7 +332,7 @@ func float32FromBits(u uint64, ovfl error) float64 { if av < 0 { av = -av } - // +Inf is OK in both 32- and 64-bit floats. Underflow is always OK. + // +Inf is OK in both 32- and 64-bit floats. Underflow is always OK. if math.MaxFloat32 < av && av <= math.MaxFloat64 { error_(ovfl) } @@ -421,7 +421,7 @@ func ignoreUint8Array(i *decInstr, state *decoderState, value reflect.Value) { // Execution engine // The encoder engine is an array of instructions indexed by field number of the incoming -// decoder. It is executed with random access according to field number. +// decoder. It is executed with random access according to field number. type decEngine struct { instr []decInstr numInstr int // the number of active instructions @@ -442,7 +442,7 @@ func (dec *Decoder) decodeSingle(engine *decEngine, ut *userTypeInfo, value refl } // decodeStruct decodes a top-level struct and stores it in value. -// Indir is for the value, not the type. At the time of the call it may +// Indir is for the value, not the type. At the time of the call it may // differ from ut.indir, which was computed when the engine was built. // This state cannot arise for decodeSingle, which is called directly // from the user's value, not from the innards of an engine. @@ -536,7 +536,7 @@ func (dec *Decoder) decodeArrayHelper(state *decoderState, value reflect.Value, } // decodeArray decodes an array and stores it in value. -// The length is an unsigned integer preceding the elements. Even though the length is redundant +// The length is an unsigned integer preceding the elements. Even though the length is redundant // (it's part of the type), it's a useful check and is included in the encoding. func (dec *Decoder) decodeArray(atyp reflect.Type, state *decoderState, value reflect.Value, elemOp decOp, length int, ovfl error, helper decHelper) { if n := state.decodeUint(); n != uint64(length) { @@ -1075,7 +1075,7 @@ func (dec *Decoder) compileIgnoreSingle(remoteId typeId) (engine *decEngine, err return } -// compileDec compiles the decoder engine for a value. If the value is not a struct, +// compileDec compiles the decoder engine for a value. If the value is not a struct, // it calls out to compileSingle. func (dec *Decoder) compileDec(remoteId typeId, ut *userTypeInfo) (engine *decEngine, err error) { defer catchError(&err) diff --git a/src/encoding/gob/decoder.go b/src/encoding/gob/decoder.go index c453e9ba39..c182941773 100644 --- a/src/encoding/gob/decoder.go +++ b/src/encoding/gob/decoder.go @@ -130,9 +130,9 @@ func (dec *Decoder) nextUint() uint64 { // decodeTypeSequence parses: // TypeSequence // (TypeDefinition DelimitedTypeDefinition*)? -// and returns the type id of the next value. It returns -1 at +// and returns the type id of the next value. It returns -1 at // EOF. Upon return, the remainder of dec.buf is the value to be -// decoded. If this is an interface value, it can be ignored by +// decoded. If this is an interface value, it can be ignored by // resetting that buffer. func (dec *Decoder) decodeTypeSequence(isInterface bool) typeId { for dec.err == nil { @@ -150,7 +150,7 @@ func (dec *Decoder) decodeTypeSequence(isInterface bool) typeId { // Type definition for (-id) follows. dec.recvType(-id) // When decoding an interface, after a type there may be a - // DelimitedValue still in the buffer. Skip its count. + // DelimitedValue still in the buffer. Skip its count. // (Alternatively, the buffer is empty and the byte count // will be absorbed by recvMessage.) if dec.buf.Len() > 0 { @@ -177,7 +177,7 @@ func (dec *Decoder) Decode(e interface{}) error { } value := reflect.ValueOf(e) // If e represents a value as opposed to a pointer, the answer won't - // get back to the caller. Make sure it's a pointer. + // get back to the caller. Make sure it's a pointer. if value.Type().Kind() != reflect.Ptr { dec.err = errors.New("gob: attempt to decode into a non-pointer") return dec.err @@ -187,7 +187,7 @@ func (dec *Decoder) Decode(e interface{}) error { // DecodeValue reads the next value from the input stream. // If v is the zero reflect.Value (v.Kind() == Invalid), DecodeValue discards the value. -// Otherwise, it stores the value into v. In that case, v must represent +// Otherwise, it stores the value into v. In that case, v must represent // a non-nil pointer to data or be an assignable reflect.Value (v.CanSet()) // If the input is at EOF, DecodeValue returns io.EOF and // does not modify v. diff --git a/src/encoding/gob/encode.go b/src/encoding/gob/encode.go index 96052ef33b..2b3a556eac 100644 --- a/src/encoding/gob/encode.go +++ b/src/encoding/gob/encode.go @@ -96,7 +96,7 @@ func (enc *Encoder) freeEncoderState(e *encoderState) { enc.freeList = e } -// Unsigned integers have a two-state encoding. If the number is less +// Unsigned integers have a two-state encoding. If the number is less // than 128 (0 through 0x7F), its value is written directly. // Otherwise the value is written in big-endian byte order preceded // by the byte length, negated. @@ -152,8 +152,8 @@ func (state *encoderState) update(instr *encInstr) { // Each encoder for a composite is responsible for handling any // indirections associated with the elements of the data structure. -// If any pointer so reached is nil, no bytes are written. If the -// data item is zero, no bytes are written. Single values - ints, +// If any pointer so reached is nil, no bytes are written. If the +// data item is zero, no bytes are written. Single values - ints, // strings etc. - are indirected before calling their encoders. // Otherwise, the output (for a scalar) is the field number, as an // encoded integer, followed by the field data in its appropriate @@ -203,9 +203,9 @@ func encUint(i *encInstr, state *encoderState, v reflect.Value) { // floatBits returns a uint64 holding the bits of a floating-point number. // Floating-point numbers are transmitted as uint64s holding the bits -// of the underlying representation. They are sent byte-reversed, with +// of the underlying representation. They are sent byte-reversed, with // the exponent end coming out first, so integer floating point numbers -// (for example) transmit more compactly. This routine does the +// (for example) transmit more compactly. This routine does the // swizzling. func floatBits(f float64) uint64 { u := math.Float64bits(f) @@ -272,7 +272,7 @@ func encStructTerminator(i *encInstr, state *encoderState, v reflect.Value) { // Execution engine // encEngine an array of instructions indexed by field number of the encoding -// data, typically a struct. It is executed top to bottom, walking the struct. +// data, typically a struct. It is executed top to bottom, walking the struct. type encEngine struct { instr []encInstr } @@ -297,7 +297,7 @@ func (enc *Encoder) encodeSingle(b *encBuffer, engine *encEngine, value reflect. defer enc.freeEncoderState(state) state.fieldnum = singletonField // There is no surrounding struct to frame the transmission, so we must - // generate data even if the item is zero. To do this, set sendZero. + // generate data even if the item is zero. To do this, set sendZero. state.sendZero = true instr := &engine.instr[singletonField] if instr.indir > 0 { @@ -386,7 +386,7 @@ func (enc *Encoder) encodeMap(b *encBuffer, mv reflect.Value, keyOp, elemOp encO // encodeInterface encodes the interface value iv. // To send an interface, we send a string identifying the concrete type, followed // by the type identifier (which might require defining that type right now), followed -// by the concrete value. A nil value gets sent as the empty string for the name, +// by the concrete value. A nil value gets sent as the empty string for the name, // followed by no value. func (enc *Encoder) encodeInterface(b *encBuffer, iv reflect.Value) { // Gobs can encode nil interface values but not typed interface @@ -417,7 +417,7 @@ func (enc *Encoder) encodeInterface(b *encBuffer, iv reflect.Value) { enc.sendTypeDescriptor(enc.writer(), state, ut) // Send the type id. enc.sendTypeId(state, ut) - // Encode the value into a new buffer. Any nested type definitions + // Encode the value into a new buffer. Any nested type definitions // should be written to b, before the encoded value. enc.pushWriter(b) data := encBufferPool.Get().(*encBuffer) diff --git a/src/encoding/gob/encoder.go b/src/encoding/gob/encoder.go index 62d0f42e81..92b559ee11 100644 --- a/src/encoding/gob/encoder.go +++ b/src/encoding/gob/encoder.go @@ -191,7 +191,7 @@ func (enc *Encoder) sendTypeDescriptor(w io.Writer, state *encoderState, ut *use return } // If the type info has still not been transmitted, it means we have - // a singleton basic type (int, []byte etc.) at top level. We don't + // a singleton basic type (int, []byte etc.) at top level. We don't // need to send the type info but we do need to update enc.sent. if !sent { info, err := getTypeInfo(ut) diff --git a/src/encoding/gob/encoder_test.go b/src/encoding/gob/encoder_test.go index 811dd2b18c..9fa01d7bfc 100644 --- a/src/encoding/gob/encoder_test.go +++ b/src/encoding/gob/encoder_test.go @@ -439,8 +439,8 @@ func (this *interfaceIndirectTestT) F() bool { return true } -// A version of a bug reported on golang-nuts. Also tests top-level -// slice of interfaces. The issue was registering *T caused T to be +// A version of a bug reported on golang-nuts. Also tests top-level +// slice of interfaces. The issue was registering *T caused T to be // stored as the concrete type. func TestInterfaceIndirect(t *testing.T) { Register(&interfaceIndirectTestT{}) @@ -463,7 +463,7 @@ func TestInterfaceIndirect(t *testing.T) { // Also, when the ignored object contains an interface value, it may define // types. Make sure that skipping the value still defines the types by using -// the encoder/decoder pair to send a value afterwards. If an interface +// the encoder/decoder pair to send a value afterwards. If an interface // is sent, its type in the test is always NewType0, so this checks that the // encoder and decoder don't skew with respect to type definitions. @@ -913,7 +913,7 @@ func TestMutipleEncodingsOfBadType(t *testing.T) { // There was an error check comparing the length of the input with the // length of the slice being decoded. It was wrong because the next // thing in the input might be a type definition, which would lead to -// an incorrect length check. This test reproduces the corner case. +// an incorrect length check. This test reproduces the corner case. type Z struct { } diff --git a/src/encoding/gob/error.go b/src/encoding/gob/error.go index 92cc0c615e..8b5265c278 100644 --- a/src/encoding/gob/error.go +++ b/src/encoding/gob/error.go @@ -9,7 +9,7 @@ import "fmt" // Errors in decoding and encoding are handled using panic and recover. // Panics caused by user error (that is, everything except run-time panics // such as "index out of bounds" errors) do not leave the file that caused -// them, but are instead turned into plain error returns. Encoding and +// them, but are instead turned into plain error returns. Encoding and // decoding functions and methods that do not return an error either use // panic to report an error or are guaranteed error-free. @@ -30,7 +30,7 @@ func error_(err error) { } // catchError is meant to be used as a deferred function to turn a panic(gobError) into a -// plain error. It overwrites the error return of the function that deferred its call. +// plain error. It overwrites the error return of the function that deferred its call. func catchError(err *error) { if e := recover(); e != nil { ge, ok := e.(gobError) diff --git a/src/encoding/gob/example_interface_test.go b/src/encoding/gob/example_interface_test.go index 4681e6307b..cf5ba38607 100644 --- a/src/encoding/gob/example_interface_test.go +++ b/src/encoding/gob/example_interface_test.go @@ -60,7 +60,7 @@ func interfaceEncode(enc *gob.Encoder, p Pythagoras) { // registered. We registered it in the calling function. // Pass pointer to interface so Encode sees (and hence sends) a value of - // interface type. If we passed p directly it would see the concrete type instead. + // interface type. If we passed p directly it would see the concrete type instead. // See the blog post, "The Laws of Reflection" for background. err := enc.Encode(&p) if err != nil { diff --git a/src/encoding/gob/example_test.go b/src/encoding/gob/example_test.go index 020352ceee..16b71236f0 100644 --- a/src/encoding/gob/example_test.go +++ b/src/encoding/gob/example_test.go @@ -24,7 +24,7 @@ type Q struct { // This example shows the basic usage of the package: Create an encoder, // transmit some values, receive them with a decoder. func Example_basic() { - // Initialize the encoder and decoder. Normally enc and dec would be + // Initialize the encoder and decoder. Normally enc and dec would be // bound to network connections and the encoder and decoder would // run in different processes. var network bytes.Buffer // Stand-in for a network connection diff --git a/src/encoding/gob/gobencdec_test.go b/src/encoding/gob/gobencdec_test.go index d674f0c784..ecc91eef1f 100644 --- a/src/encoding/gob/gobencdec_test.go +++ b/src/encoding/gob/gobencdec_test.go @@ -376,7 +376,7 @@ func TestGobEncoderIndirectArrayField(t *testing.T) { } // As long as the fields have the same name and implement the -// interface, we can cross-connect them. Not sure it's useful +// interface, we can cross-connect them. Not sure it's useful // and may even be bad but it works and it's hard to prevent // without exposing the contents of the object, which would // defeat the purpose. @@ -434,7 +434,7 @@ func TestGobEncoderValueEncoder(t *testing.T) { } // Test that we can use a value then a pointer type of a GobEncoder -// in the same encoded value. Bug 4647. +// in the same encoded value. Bug 4647. func TestGobEncoderValueThenPointer(t *testing.T) { v := ValueGobber("forty-two") w := ValueGobber("six-by-nine") diff --git a/src/encoding/gob/type.go b/src/encoding/gob/type.go index cf5cec0703..c27f7e9707 100644 --- a/src/encoding/gob/type.go +++ b/src/encoding/gob/type.go @@ -17,7 +17,7 @@ import ( ) // userTypeInfo stores the information associated with a type the user has handed -// to the package. It's computed once and stored in a map keyed by reflection +// to the package. It's computed once and stored in a map keyed by reflection // type. type userTypeInfo struct { user reflect.Type // the type the user handed us @@ -44,7 +44,7 @@ var ( ) // validType returns, and saves, the information associated with user-provided type rt. -// If the user type is not valid, err will be non-nil. To be used when the error handler +// If the user type is not valid, err will be non-nil. To be used when the error handler // is not set up. func validUserType(rt reflect.Type) (ut *userTypeInfo, err error) { userTypeLock.RLock() @@ -64,7 +64,7 @@ func validUserType(rt reflect.Type) (ut *userTypeInfo, err error) { ut.base = rt ut.user = rt // A type that is just a cycle of pointers (such as type T *T) cannot - // be represented in gobs, which need some concrete data. We use a + // be represented in gobs, which need some concrete data. We use a // cycle detection algorithm from Knuth, Vol 2, Section 3.1, Ex 6, // pp 539-540. As we step through indirections, run another type at // half speed. If they meet up, there's a cycle. @@ -493,7 +493,7 @@ func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, err // For arrays, maps, and slices, we set the type id after the elements // are constructed. This is to retain the order of type id allocation after // a fix made to handle recursive types, which changed the order in - // which types are built. Delaying the setting in this way preserves + // which types are built. Delaying the setting in this way preserves // type ids while allowing recursive types to be described. Structs, // done below, were already handling recursion correctly so they // assign the top-level id before those of the field. @@ -597,7 +597,7 @@ func getBaseType(name string, rt reflect.Type) (gobType, error) { // getType returns the Gob type describing the given reflect.Type. // Should be called only when handling GobEncoders/Decoders, -// which may be pointers. All other types are handled through the +// which may be pointers. All other types are handled through the // base type, never a pointer. // typeLock must be held. func getType(name string, ut *userTypeInfo, rt reflect.Type) (gobType, error) { @@ -642,7 +642,7 @@ func bootstrapType(name string, e interface{}, expect typeId) typeId { // For bootstrapping purposes, we assume that the recipient knows how // to decode a wireType; it is exactly the wireType struct here, interpreted // using the gob rules for sending a structure, except that we assume the -// ids for wireType and structType etc. are known. The relevant pieces +// ids for wireType and structType etc. are known. The relevant pieces // are built in encode.go's init() function. // To maintain binary compatibility, if you extend this type, always put // the new fields last. @@ -789,7 +789,7 @@ func mustGetTypeInfo(rt reflect.Type) *typeInfo { // // Note: Since gobs can be stored permanently, it is good design // to guarantee the encoding used by a GobEncoder is stable as the -// software evolves. For instance, it might make sense for GobEncode +// software evolves. For instance, it might make sense for GobEncode // to include a version number in the encoding. type GobEncoder interface { // GobEncode returns a byte slice representing the encoding of the @@ -838,8 +838,8 @@ func RegisterName(name string, value interface{}) { } // Register records a type, identified by a value for that type, under its -// internal type name. That name will identify the concrete type of a value -// sent or received as an interface variable. Only types that will be +// internal type name. That name will identify the concrete type of a value +// sent or received as an interface variable. Only types that will be // transferred as implementations of interface values need to be registered. // Expecting to be used only during initialization, it panics if the mapping // between types and names is not a bijection. |
