BufBills
BufBills

Reputation: 8103

go import github, how to set up?

trying to run a go test code and have this issue. It has import like this:

"github.com/abcd/abcd"

Then, when I run it, it failed to find the package.

I noticed this is a common practice to import github stuff like this. For me, what is the right the way to handle it?

thanks.

Upvotes: 0

Views: 1102

Answers (1)

fabmilo
fabmilo

Reputation: 48330

This should download the repository inside your gopath

mkdir -P $PWD/gopath/{bin,src,pkg}

export GOPATH=$PWD/gopath:$GOPATH

go get "github.com/abcd/abcd"

ls gopath/src/github.com/abcd/abcd

If you tell us what specific repository you may get more accurate info on how to accomplish your task

Upvotes: 2

Related Questions