command not found after go build

-bash: go: command not found mac
go command not found centos 7
go command not found kali linux
bin/sh go not found docker
zsh command not found go generate
godog command not found
bee command not found
goimports command not found

I have install and setup go.

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

I have created a package at following location.


I build inside package folder using

go build

It creates binary in bin folder inside GOPATH But when I try to run package name from command line it gives following error.

symbol: command not found

How can I execute binary from command line ?

You need following configuration for ubuntu.

$ sudo gedit ~/.bashrc

Add the following config

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

/usr/local/go/bin will be your go installation path and $GOPATH/bin will be where your custom build packages will get installed.

Go command not found · Issue #1489 · github/hub · GitHub, It's very confusing that you're able to run go from your terminal, but when you run script/build , the go command is suddenly unavailable. This  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

On Windows:

1) Set $GOPATH env , e.g. $HOME/go
2) Add $GOPATH/bin into $PATH

It should work now.

Installed golang still go: command not found · Issue #20 , I installed the golang but still it's showing go command not found. I have installed golang and after that I am running this command go env -fmessage-​length=0 -fdebug-prefix-map=/tmp/go-build786735881=/tmp/go-build  christian bader added a comment - 2017-08-25 06:18 Christopher Orr I use the job-dsl-plugin to maintain the job configurations. It's running on a 64bit machine The go tools are NOT part of the PATH variable until I save the configuration via the web interface (without changing anything) After saving manually via the web interface, the go tools are part of the PATH variable.

for mac

example I put custom go folder in workspace directory. you could change my custom go directory workspace by your own.

add the following script to .bashrc

export GOROOT="/usr/local/go"
export GOPATH="$HOME/workspace/go"
export PATH="$HOME/workspace/go/bin:$PATH"

then run source .bashrc on your terminal

golang - command 'go' not found, After moving it, I can't use any Go command, and I get command 'go' not found. I tried moving the file back to the home directory, but I'm still  Now that you know how go build works, and how to investigate the build process with -x, try passing that flag to go test and observe the result. Additionally, if you have gccgo installed on your system, you can pass -compiler gccgo to go build, and using -x investigate how Go code is built using this compiler.

I was having a similar problem on OSX, I found this the easiest way to get golang up and running:

With HomeBrew:

brew install go

Then add these to your .bash_profile:

export PATH=$PATH:$GOPATH/bin
export GOPATH=$HOME/.go

[Golang Installation Problems]Installed golang still go: command not , gkz@localhost ~$ go build. Command 'go' not found, but can be installed with:​sudo snap install go # version 1.12.9, or sudo apt install  answers with: command not found Of course I can google and as a developer I can easily solve such problems after some reasearch, but it shows how much the instructions really suck. They are not only lacking, they are incomplete and misleading.

Bash can't find go exectuable after installing Go package for OS X , Go should be installed to either /usr/local/go/bin or ~/Go/bin — I can't test the installer now. Try editing your ~/.bash_profile by calling: nano ~/.bash_profile. command not found after go build. Ask Question Asked 3 years, 4 months ago. Active 14 days ago. Viewed 17k times 5. 2. I have install and setup go. export GOPATH

build, It is consulted to resolve imports that cannot be found in the standard Go tree. The default To build a file only when using cgo, and only on Linux and OS X: I thought the issue could be that gcc is in my user path but not my system path but I will try all of these things. Hey @Jason-Abbott, after I do go install, is there anything special I need to do to use the "installed" file? I thought I did go get & go install before, but it still told me it could not find gcc.

What can be the reason my go install doesn't work at all? : golang, go get downloads the package, plants it where it's supposed to be, I've tried to manually enter the package and run go install there, but that doesn't work too (​command not found). -fdebug-prefix-map=/tmp/go-build082006211=/tmp/go-​build I usually go for go-bindata, or sometimes for parchello, but when I had to​  The go command accepts a "module query" in place of a module version both on the command line and in the main module's go.mod file. (After evaluating a query found in the main module's go.mod file, the go command updates the file to replace the query with its result.)

  • Have you added $GOPATH/bin to your PATH?
  • And use go install to install the binary in GOPATH/bin
  • Yes I already did both the steps you mentioned
  • Related: What does go build build? go build leaves the executable in the current working directory.
  • That isn't a main package. It doesn't build a binary.
  • Also don't forget to reload the configuration once its changed with source ~/.bashrc
  • Thanks, this work for me. I using zshrc, sudo nano ~/.zshrc
  • on windows its %GOPATH% into %PATH%
  • Pretty sure that should be %GOPATH%\bin added to %PATH% if you are on WIndows