Building MongoDB Tools From Source failed

194 views
Skip to first unread message

Astro

unread,
Dec 9, 2015, 7:27:40 AM12/9/15
to mongodb-user
I am building mongodb tools from source using the official document.

I have setup go 1.5.2.
Set GOROOT to /xvdh/go
Set PATH=$PATH:$GOROOT/bin

Executed ./set_gopath.sh from mongo-tools directory.

Also while building mongoimport using go build -o bin/mongoimport mongoimport/main/mongoimport.go

Getting following error:

mongoimport/main/mongoimport.go:6:2: cannot find package "github.com/mongodb/mongo-tools/common/db" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/common/db (from $GOROOT)
        ($GOPATH not set)
mongoimport/main/mongoimport.go:7:2: cannot find package "github.com/mongodb/mongo-tools/common/log" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/common/log (from $GOROOT)
        ($GOPATH not set)
mongoimport/main/mongoimport.go:8:2: cannot find package "github.com/mongodb/mongo-tools/common/options" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/common/options (from $GOROOT)
        ($GOPATH not set)
mongoimport/main/mongoimport.go:9:2: cannot find package "github.com/mongodb/mongo-tools/common/signals" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/common/signals (from $GOROOT)
        ($GOPATH not set)
mongoimport/main/mongoimport.go:10:2: cannot find package "github.com/mongodb/mongo-tools/common/util" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/common/util (from $GOROOT)
        ($GOPATH not set)
mongoimport/main/mongoimport.go:11:2: cannot find package "github.com/mongodb/mongo-tools/mongoimport" in any of:
        /usr/local/go/src/github.com/mongodb/mongo-tools/mongoimport (from $GOROOT)
        ($GOPATH not set)

Do I need to set GOPATH again? echo $GOPATH returns nothing. Any help?



Wan Bachtiar

unread,
Dec 9, 2015, 8:21:41 PM12/9/15
to mongodb-user

Hi Astro,

When you run the set_gopath.sh script, it only sets the $GOPATH in a subshell, and it only valid within the context of that subshell.

Try running this instead:

source ./set_gopath.sh

or

. ./set_gopath.sh

I’ll create a JIRA ticket to update the docs for this.

Kind regards,

Wan

Astro

unread,
Dec 11, 2015, 5:14:10 AM12/11/15
to mongodb-user
Thanks, Wan.

That solves this issue.


- astro 
Reply all
Reply to author
Forward
0 new messages