Home > Enterprise >  Go package unusable after installation
Go package unusable after installation

Time:04-15

I recently installed a new package for one of my Go introductory projects named go-bindata, I have followed the installation guide, but after I tried to run the command, this showed up.

$ go-bindata
bash: go-bindata: command not found

I have referred to one similar problem on stackoverflow, and the solution given is setting $GOPATH, I'm on a windows operating system, and I have already configured my $GOPATH in $PATH as the image shown below, I don't know which step I got wrong.

Environment vairiable & Path

(I'm sorry for the inconvience on the attached image since I'm not allowed to attach an image directly to the post.)

CodePudding user response:

To perform the installation with modern versions of Go, you should run:

go install github.com/go-bindata/go-bindata/go-bindata@latest

This command will compile and put the binary into the GOPATH\bin folder on your machine, so if you want to be able to run it from anywhere, you should add GOPATH\bin to your PATH.

And then try and run it:

go-bindata

It's a bit awkward repetition, because of the project directory structure. The first go-bindata is github username, the second is the project name and the third is where the main package of the program is to be found.

  • Related