gob Questions
3
Solved
I'm looking for a good solution for a client/server communication with UDP sockets in Go language.
The examples I found on the Internet show me how to send data to the server, but they do not teac...
3
Solved
Can we expect for two Go objects x, y such that x is equal to y (assuming no trickiness with interfaces and maps, just structs and arrays) that the output of gob_encode(x) and gob_encode(y) will al...
2
Solved
I believe this is a legitimate use case for Gob serialization. Yet enc.Encode returns an error because Something has no exported field. Note that I’m not serializing Something directly but only Com...
3
I have read the documentation of ( gob) and I have some problems :
Now I know how to encode structure and decode like that:
func main() {
s1 := &S{
Field1: "Hello Gob",
Field2: 999...
3
Solved
Would it be possible to use Gob encoding for appending structs in series to the same file using append? It works for writing, but when reading with the decoder more than once I run into:
extra dat...
Doc asked 4/4, 2017 at 5:44
1
Solved
I have these types defined:
func init() {
gob.RegisterName("MyMessageHeader", MyMessageHeader{})
gob.RegisterName("OtherMsg", OtherMsg{})
}
//
// Messages
//
type MyMessageHeader struct {
Mes...
1
Solved
I am trying to decode a gob output that I am sending through another fasthttp endpoint and receiving an error
Fasthttp endpoint(encode []string through gob) ----> Fasthttp endpoint( receive and ...
1
Solved
Q: Is there a way, in golang, to define a function which accepts an array of arbitrary length as argument?
e.g.,
function demoArrayMagic(arr [magic]int){
....
}
I have understood that in golan...
1
Solved
I am using go 1.9. And I want to deepcopy value of object into another object. I try to do it with encoding/gob and encoding/json. But it takes more time for gob encoding than json encoding. I see ...
1
I want to use gob to encode and decode object, I do it like this:
type transProp struct {
a []int
b []float64
}
func (p transProp) MarshalBinary() ([]byte, error) {
// A simple encoding: plain...
2
Solved
I have a struct with unexported fields which should be gob encoded and decoded.
Say:
type A struct {
s int
}
func (a *A) Inc() {
a.s++
}
Obviously in that case I need to implement gob.GobEnco...
2
Solved
I am writing an application in Go which uses encoding/gob to send structures and slices over UDP between nodes. It works fine but I notice that encoding/json also has the similar API. Searched and ...
3
Solved
I've been tasked to replace C++ code to Go and I'm quite new to the Go APIs. I am using gob for encoding hundreds of key/value entries to disk pages but the gob encoding has too much bloat that's n...
Ilysa asked 3/6, 2016 at 15:35
1
Solved
I have been struggling to understand the difference between encoding/decoding an interface type when that type is embedded in a struct, vs. when it's not embedded at all.
Using the following examp...
2
Solved
gob fails to encode map[string]interface{}
gob: type not registered for interface: map[string]interface {}
http://play.golang.org/p/Si4hd8I0JE
package main
import (
"bytes"
"encoding/gob"
"...
3
Solved
I will be creating a structure more or less of the form:
type FileState struct {
LastModified int64
Hash string
Path string
}
I want to write these values to a file and read them in on subseq...
Wendolyn asked 13/10, 2011 at 5:47
2
Solved
I'm trying to de- and encode a struct which contains a Interface{} as field.
The problem there is, that the encoding works fine, but if I try to decode the data to data the value gets { <nil&g...
1
I have a client server application, using TCP connection
Client:
type Q struct {
sum int64
}
type P struct {
M, N int64
}
func main() {
...
//read M and N
...
tcpAddr, err := net.ResolveT...
1
© 2022 - 2024 — McMap. All rights reserved.