Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go no install location for directory outside GOPATH error when run "go get"

Tags:

go

gopath

Simple Go project, with a external dependence:

import (  
        "fmt"  
        "html"  
        "log"  
        "net/http"  
        "github.com/gorilla/mux"  
)

My path working fine for other tasks like run, build, etc.: GOPATH="/home/racar/go"

But when I try to get a external package with "go get" command, I got this error:

"go install: no install location for directory... outside GOPATH"

Edit: I have set my PATH in ~/.bashrc: export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

like image 252
racar Avatar asked Dec 18 '22 06:12

racar


1 Answers

According with this link: github.com/golang/go/wiki/SettingGOPATH

Is needed to set GOBIN path in bash file: export GOBIN=$GOPATH/bin

like image 148
racar Avatar answered May 25 '23 17:05

racar