I have a problem with my go installation. I'm using Manjaro and I think it is related to this as Manjaro seems to handle the go env differently then suggestest by ubuntu and windows.
I have go installed and can run code as expected:
$ go run gitlab.com/gitlabtest
Hello, GitLab!
Then I check if there any enviroment variables set with:
$ echo $GOROOT
$ echo $GOPATH
$ echo $GOBIN
$
So there are non as it seems which is odd. Why could I run my test program? I try to check for environment variables another way:
$ go env GOROOT
/usr/lib/go
$ go env GOPATH
/home/bluebrown/go
$ go env GOBIN
$
That is interesting. Go itself seems to have some knowledge of the environment variables. That's probably why I can run go code from anywhere, effectively targeting $GOPATH.
There is just one problem, $GOBIN seem to be unset.
OK, that means I have to edit my ~/.bash_profile I guess.
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
export GOROOT=/usr/lib/go
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
Finally I get the result I want as it seems:
$ source .bash_profile
$ echo $GOROOT &&echo $GOPATH &&echo $GOBIN
/usr/lib/go
/home/bluebrown/go
/home/bluebrown/go/bin
$
$ go env GOROOT &&go env GOPATH &&go env GOBIN
/usr/lib/go
/home/bluebrown/go
/home/bluebrown/go/bin
Thats great now I can use packages from the $GOBIN like glide or govendor right?
[~]$ go get -u -v github.com/kardianos/govendor
github.com/kardianos/govendor (download)
[~]$ cd $GOPATH/src
[src]$ mkdir testdir
[src]$ cd testdir
[testdir]$ govendor init
bash: govendor: command not found
Well maybe not. So I try glide:
$ curl https://glide.sh/get | sh
$...
$which: no glide in
$ (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:
/usr/lib/jvm/default/bin:/usr/bin/site_perl:
/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/local/go/bin)
glide not found. Did you add $GOBIN to your $PATH?
Fail to install glide
So it turns out that no matter what pack I have in $GOBIN it can't get found.
When I restart the device, everything is reset again for some reason :(
At this point I don't know anymore what to do.