OT-CONTAINER-KIT / mongodb-operator

A golang based operator to create and manage MongoDB standalone setup and cluster setup
https://ot-mongodb-operator.netlify.app
Apache License 2.0
44 stars 7 forks source link

mongo/mongo.go:78:3: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields #67

Open sadath-12 opened 1 year ago

sadath-12 commented 1 year ago

Run command "make run" to start the operator run into issue that looks similar to this

// /home/sadath/go/bin/controller-gen rbac:roleName=mongodb-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
// /home/sadath/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
// go fmt ./...
// go vet ./...
// # mongodb-operator/mongo
// mongo/mongo.go:77:3: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields
// mongo/mongo.go:77:35: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields
// 
// mongo/mongo.go:104:58: go.mongodb.org/mongo-driver/bson/primitive.E struct literal uses unkeyed fields
// make: *** [Makefile:86: vet] Error 1

Solution to fix this issue is to add Key and Value for running db command for user and role for Example

change this

{"createUser", monitoringUser}, { "pwd",  params.Password}

To

{Key: "createUser", Value: monitoringUser}, {Key: "pwd", Value: params.Password}
sadath-12 commented 1 year ago

Added pr https://github.com/OT-CONTAINER-KIT/mongodb-operator/pull/68