Facing issue importing golang mongodb driver.
go get -u go.mongodb.org/mongo-driver/mongo
go get -u go.mongodb.org/mongo-driver/mongo@~1.0.0
package go.mongodb.org/mongo-driver/mongo: unrecognized import path "go.mongodb.org/mongo-driver/mongo" (https fetch: Get https://go.mongodb.org/mongo-driver/mongo?go-get=1: dial tcp: lookup go.mongodb.org: no such host)
I would suggest using the mgo library.
import (
mgo "gopkg.in/mgo.v2"
)
You can find more information about this library here: https://gopkg.in/mgo.v2
I used it for multiple websites and it worked like a charm every time.
It seems to be a network issue. Try some another network connection which is not ruled under firewall.
Or else you can use go mod to resolve dependencies automatically.
I am also using the same driver for mongo DB and it is working perfectly fine.
Kindly check here - Golang-Mongo-Driver-Example