How to import official mongoDB driver package in Go?
I am following the official Go-mongoDB-driver package instruction (https://www.mongodb.com/blog/post/mongodb-go-driver-tutorial). I have installed the mongoDB package using this:
go get github.com/mongodb/mongo-go-driver
but I just can't import the package
I am doing a very simple snippet in my main.go
package main
import "github.com/mongodb/mongo-go-driver/mongo
func main() {
}
This gives me:
main.go:8:8: code in directory $GOPATH/src/github.com/mongodb/mongo-go-driver/bson expects import "go.mongodb.org/mongo-driver/bson"
When I tried to import go.mongodb.org/mongo-driver/bson
, It gives me this:
main.go:10:8: cannot find package "go.mongodb.org/mongo-driver/bson" in any of:
/usr/local/go/src/go.mongodb.org/mongo-driver/bson (from $GOROOT)
$GOPATH/src/go.mongodb.org/mongo-driver/bson (from $GOPATH)
Kindly help, quite new in Go and not sure where to look since I don't find people having this issue a lot.