LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package gob | 5 package gob |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 "os" | 10 "os" |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 // GobDecoder is the interface describing data that provides its own | 705 // GobDecoder is the interface describing data that provides its own |
706 // routine for decoding transmitted values sent by a GobEncoder. | 706 // routine for decoding transmitted values sent by a GobEncoder. |
707 type GobDecoder interface { | 707 type GobDecoder interface { |
708 // GobDecode overwrites the receiver, which must be a pointer, | 708 // GobDecode overwrites the receiver, which must be a pointer, |
709 // with the value represented by the byte slice, which was written | 709 // with the value represented by the byte slice, which was written |
710 // by GobEncode, usually for the same concrete type. | 710 // by GobEncode, usually for the same concrete type. |
711 GobDecode([]byte) error | 711 GobDecode([]byte) error |
712 } | 712 } |
713 | 713 |
714 var ( | 714 var ( |
715 » registerLock sync.RWMutex | 715 » registerLock sync.RWMutex |
716 nameToConcreteType = make(map[string]reflect.Type) | 716 nameToConcreteType = make(map[string]reflect.Type) |
717 concreteTypeToName = make(map[reflect.Type]string) | 717 concreteTypeToName = make(map[reflect.Type]string) |
718 ) | 718 ) |
719 | 719 |
720 // RegisterName is like Register but uses the provided name rather than the | 720 // RegisterName is like Register but uses the provided name rather than the |
721 // type's default. | 721 // type's default. |
722 func RegisterName(name string, value interface{}) { | 722 func RegisterName(name string, value interface{}) { |
723 if name == "" { | 723 if name == "" { |
724 // reserved for nil | 724 // reserved for nil |
725 panic("attempt to register empty name") | 725 panic("attempt to register empty name") |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 Register([]uint32(nil)) | 818 Register([]uint32(nil)) |
819 Register([]uint64(nil)) | 819 Register([]uint64(nil)) |
820 Register([]float32(nil)) | 820 Register([]float32(nil)) |
821 Register([]float64(nil)) | 821 Register([]float64(nil)) |
822 Register([]complex64(nil)) | 822 Register([]complex64(nil)) |
823 Register([]complex128(nil)) | 823 Register([]complex128(nil)) |
824 Register([]uintptr(nil)) | 824 Register([]uintptr(nil)) |
825 Register([]bool(nil)) | 825 Register([]bool(nil)) |
826 Register([]string(nil)) | 826 Register([]string(nil)) |
827 } | 827 } |
LEFT | RIGHT |