encoding/gob: does not overwrite zero values of structures #22862
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9 darwin/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/cqx874/projects/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/84/h3xfrt592ss8j1199p0sg4bc0000gn/T/go-build983167319=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
I have a stream generated by
GobEncoder
which is being read in a cycle byGobDecoder
.Documentation states:
However if any field in the structure being received is zero, it won't be populated by
GobDecorer.Decode()
.Example: https://play.golang.org/p/ifu1Bj2j_v
What did you expect to see?
decoded: {10}
decoded: {0}
decoded: {20}
What did you see instead?
decoded: {10}
decoded: {10}
decoded: {20}
The text was updated successfully, but these errors were encountered: