Fixed bug where zero value was not being used
if you read gob docs it states the following: " If a field has the zero value for its type, it is omitted from the transmission." That's powerful savings. I didn't know. Now it works as one would expect.
This commit is contained in:
+2
-2
@@ -19,7 +19,6 @@ func main() {
|
||||
|
||||
log.Println("locked and loaded")
|
||||
|
||||
point := robo.Point{}
|
||||
for {
|
||||
var err error
|
||||
conn, err := ln.Accept()
|
||||
@@ -30,6 +29,7 @@ func main() {
|
||||
|
||||
dec := gob.NewDecoder(conn)
|
||||
for {
|
||||
point := robo.Point{}
|
||||
err = dec.Decode(&point)
|
||||
if err != nil {
|
||||
break
|
||||
@@ -40,6 +40,6 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
}
|
||||
|
||||
fmt.Printf("disconnect: %+v\n", conn)
|
||||
log.Printf("disconnect: %+v\n", conn)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user