Golang encoding/gob.Encoder.EncodeValue() function example
package encoding/gob
EncodeValue transmits the data item represented by the reflection value, guaranteeing that all necessary type information has been transmitted first.
Golang encoding/gob.Encoder.EncodeValue() function usage example
func (gobCodec) Write(w io.Writer, v reflect.Value, b WriteBasic) (err error) {
if err = binary.Write(w, binary.BigEndian, Gob); err != nil {
return
}
return gob.NewEncoder(w).EncodeValue(v) // <---- here
}
References :
http://golang.org/pkg/encoding/gob/#Encoder.EncodeValue
https://github.com/markchadwick/typedbytes/blob/master/gob.go
Advertisement
Something interesting
Tutorials
+14.6k Golang : How to get URL port?
+8.5k Linux/Unix : fatal: the Postfix mail system is already running
+9.3k Golang : How to get ECDSA curve and parameters data?
+6k Javascript : Get operating system and browser information
+12.7k Golang : Sort and reverse sort a slice of bytes
+14.1k Javascript : Prompt confirmation before exit
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+7.3k Golang : Not able to grep log.Println() output
+11.7k How to tell if a binary(executable) file or web application is built with Golang?
+7k Golang : How to call function inside template with template.FuncMap
+5.3k Golang : How to deal with configuration data?
+11k Golang : Create Temporary File