debuggoCritical
How do I install requirements in Go? "cannot find package"
Viewed 0 times
howpackageinstallfindrequirementscannot
Problem
I'm new to Go and I'm trying to set up a Go project with minimal documentation: https://github.com/alphagov/metadata-api
I've cloned it, but when I try
I'm guessing this is because I haven't installed the Go equivalent of requirements?
My
And the Go executable is in
What do I need to do to help Go find these packages?
I've cloned it, but when I try
go build I get the following warnings: main.go:8:2: cannot find package "github.com/Sirupsen/logrus" in any of:
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/Sirupsen/logrus (from $GOROOT)
/Users/me/go/src/github.com/Sirupsen/logrus (from $GOPATH)
main.go:14:2: cannot find package "github.com/alphagov/metadata-api/content_api" in any of:
/usr/local/Cellar/go/1.3.3/libexec/src/pkg/github.com/alphagov/metadata-api/content_api (from $GOROOT)
/Users/me/go/src/github.com/alphagov/metadata-api/content_api (from $GOPATH)I'm guessing this is because I haven't installed the Go equivalent of requirements?
My
GOPATH is set:metadata-api$ echo $GOPATH
/Users/me/goAnd the Go executable is in
metadata-ape$ echo $PATH
....:/Users/me/go/binWhat do I need to do to help Go find these packages?
Solution
You should install package first:
try
and check you
This project use
Make sure you have installed
or try this command
I think your
try
$ go get github.com/Sirupsen/logrusand check you
$GOPATH dirThis project use
gom as the package manager, Make sure you have installed
gomor try this command
$ gom installI think your
$GOPATH and $PATH settings are incorrect, the $GOPATH environment variable specifies the location of your workspace, these are my path settings:export GOROOT=$HOME/bin/go
export GOBIN=$GOROOT/bin
export GOPATH=$HOME/golang
export PATH=$PATH:$GOBINCode Snippets
$ go get github.com/Sirupsen/logrus$ gom installexport GOROOT=$HOME/bin/go
export GOBIN=$GOROOT/bin
export GOPATH=$HOME/golang
export PATH=$PATH:$GOBINContext
Stack Overflow Q#27249420, score: 102
Revisions (0)
No revisions yet.