Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go vet fail composite literal uses unkeyed fields #32100

Closed
orange-jacky opened this issue May 17, 2019 · 1 comment
Closed

go vet fail composite literal uses unkeyed fields #32100

orange-jacky opened this issue May 17, 2019 · 1 comment

Comments

@orange-jacky
Copy link

Please answer these questions before submitting your issue. Thanks!

What did you do?

i use package "go.mongodb.org/mongo-driver/bson"

....
filter := bson.D{{"sp.inserttime", bson.D{{"$gte", int64(timestamp)}}}}
ctx := context.Background()
cur, err := collection.Find(ctx, filter)
....

go build my code, it success

meanwhile, go vet it, an it failed

What did you expect to see?

go vet ok

What did you see instead?

go.mongodb.org/mongo-driver/bson/primitive.E composite literal uses unkeyed fields

System details

go version go1.12.5 darwin/amd64
GOARCH="amd64"
GOBIN="/Users/fredlee/Documents/develop/go/workspace/bin"
GOCACHE="/Users/fredlee/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/fredlee/Documents/develop/go/workspace"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOROOT/bin/go version: go version go1.12.5 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.5
uname -v: Darwin Kernel Version 18.2.0: Fri Oct  5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.14.1
BuildVersion:	18B75
lldb --version: lldb-1000.11.38.2
  Swift-4.2
@ianlancetaylor
Copy link
Contributor

This is working as expected. This is the vet test "composites", documented as "check for unkeyed composite literals". I'm going to close this bug since this is what is supposed to happen. Please comment if I have misunderstood.

@golang golang locked and limited conversation to collaborators May 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants