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...
Stopple asked 25/9, 2014 at 0:39

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...
Bluebeard asked 20/10, 2015 at 5:31

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...
Minier asked 16/5, 2018 at 16:10

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...
Polyphyletic asked 20/9, 2015 at 7:26

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...
Forb asked 19/2, 2019 at 12:37

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 ...
Aardwolf asked 12/10, 2018 at 7:55

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...
Seventy asked 16/5, 2018 at 11:55

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 ...
Uncleanly asked 17/10, 2017 at 12:31

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...
Amandaamandi asked 31/5, 2017 at 16:56

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...
Mickey asked 10/4, 2017 at 13:44

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 ...
Aubervilliers asked 16/12, 2016 at 7:39

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...
Brutify asked 26/1, 2016 at 2:35

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" "...
Koester asked 21/2, 2014 at 12:38

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...
Octuple asked 2/1, 2013 at 11:41

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...
Blount asked 26/6, 2012 at 6:49
1

© 2022 - 2024 — McMap. All rights reserved.