Open
Description
Probably related to: #147
I have a struct with:
type Foo struct {
Bar []string
}
I need to differentiate bar == nil
or bar == []string{}
.
When insert + findOne with a nil
bar:
expected: []string(nil)
actual : []string{}
When adding omitempty
tag previous test will be okay but test on insert + findOne with a []string{}
bar:
expected: []string{}
actual : []string(nil)
I have to add a layer above to handle those cases properly, it would be more convenient (and not breaking ?) to handle this directly in the driver.
What version of MongoDB are you using (mongod --version
)?
db version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
allocator: tcmalloc
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
What version of Go are you using (go version
)?
go version go1.12.2 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN="/home/foo/go/bin"
GOCACHE="/home/foo/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/foo/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build942599151=/tmp/go-build -gno-record-gcc-switches"
What did you do?
db.Insert
+ db.Find
on an embed slice.
Can you reproduce the issue on the latest development
branch?
yes
Metadata
Metadata
Assignees
Labels
No labels