Golang and go-bindata are not founded

Updated at

2024.3.9

Created at

2020.8.6

Go comes with an installation package that makes it easy to build an environment without typing commands, but there are cases where it does not work when you try to run it. This is usually due to an incorrect path.

Set the path of Go

terminal
// for ZSH
$ vim ~/.zshrc

// for bash
$ vim ~/.bash_profile

Add /usr/local/bin/go to the PATH.

Set the path of go-bindata

I have received the following error when trying to make a package for installation.

/bin/sh: go-bindata: command not found

The logs show that go-bindata was downloaded, but the command cannot be found. The directory ~/go/bin/go-bindata exists, so the path does not work.

Since GOPATH is often set directly under the home directory by convention, set GOPATH=$HOME/go and add $GOPATH/bin to the PATH.

Configuration

.zshrc
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

If you can set it up as described above, it will work.

terminal
$ source ~/.zshrc
$ go version
go version go1.14.6 darwin/amd64

mktia's note

Research & Engineering / Blockchain / Web Dev

© 2017-2025 mktia. All rights reserved.