• Register
0 votes

Problem :

I want to install the custom package for my main.go file. But, whenever I try to run below command :

go install custom.go

I often face below error :

go install: no install location for .go files listed on command line (GOBIN not set)

How can I fix this issue ?

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Please check your GOPATH variable.
Please make sure:

· Your sources should be under the GOPATH/src

· You must have the bin folder within your GOPATH folder.

The command with your source in DIR/src/foo/quux should be installed into DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix should be stripped so that you can add DIR/bin to your PATH to get all the installed commands.

If your GOBIN environment variable is set the commands are installed to the directory it names instead of DIR/bin. GOBIN must be the absolute path.

It appears as if your GOPATH is set to ~/go but you ran the go install command on the ~/dev/go

The Go path is the list of directory trees containing the Go source code. It is considered to resolve the imports which cannot be found in the standard Go tree.

If you have done go build correctly then you can also try a go install and you need to install the package, not a single file.

38.6k points
Issue in go Install

Related questions

0 votes
1 answer 16 views
Problem: Support is needed because I have been unable to find a solution : Go install: no install location for .go files listed on command line (gobin not set)
asked Jun 13 asha 121k points
0 votes
1 answer 15 views
Problem: I am attempting to create a container with my Go binary in for use as a database migrator. If I run the binary it works perfectly, however, I am struggling to put it into a container and run it in my docker-compose stack. Below is my ... this error in the logs for my database migrator container. data-migrator_1 | standard_init_linux.go:190: exec user process caused "exec format error"
asked Apr 26 anika11 32.2k points
0 votes
1 answer 23 views
Problem: HELP! I need help understanding this problem? protoc-gen-go: program not found or is not executable
asked Apr 7 Rohit kr 17.5k points
0 votes
1 answer 43 views
Problem: I am trying to build docker image for scigraph, the image is getting built successfully but when I try to run I'm getting following error standard_init_linux.go:195: exec user process caused "exec format error" I am copying already compiled scigraph, and copying the binary version to docker
asked May 1 padma1 34.8k points
0 votes
1 answer 36 views
Problem: Git bash make command not found windows.
asked Jul 22 Rada Gracelynn 104k points
0 votes
1 answer 13 views
Problem: Please Support is needed > No avaiable connection: no elasticsearch node available .
asked May 11 Isac Christiaan 103k points
0 votes
1 answer 4 views
Problem: Go install: no install location for directory.
asked Jul 7 Aurelia Maja 78.4k points
0 votes
1 answer 156 views
Problem: why this happened with me : Fatal: could not read username for 'https://github.com': terminal prompts disabled.
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 4.4k views
Problem : I created my private repo examplessite/myprivaterepo using my Github UI from my browser. Then I went to my go directory which is on my desktop and tried to clone it: $ cd $GOPATH $ go get github.com/examplessite/myprivaterepo So far so good. I created ... .com/examplessite/myprivaterepo: exit status 128 Why is the laptop ignoring my own repo and how can I make it to accept its luck?
asked Dec 17, 2019 alecxe 7.5k points
0 votes
1 answer 114 views
Problem: As I can't change the cert on the device- what part of the TLS client config can I modify to accept it?
asked Apr 30 ochena 23.3k points