• 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 ?

6 5 3
7,540 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.

9 7 4
38,600 points
Issue in go Install

Related questions

0 votes
1 answer 2 views
Problem: HELP! I need help understanding this problem? protoc-gen-go: program not found or is not executable
asked 5 days ago Rohit kr 15.5k points
0 votes
1 answer 36 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 3.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 2 views
Problem: tried executing this from my go program and it keeps giving me an error saying: it can-not find "command" in my $PATH, which is to be expected since it's a built-in command in linux and not a binary.
asked 2 days ago ummesalma 24.5k points
0 votes
1 answer 2 views
Problem: please help me to solve... syntax error: non-declaration statement outside function body
asked Apr 1 Ifra 24.4k points
1 vote
1 answer 19 views
Problem: I'm new in GoLang and I am trying to use strconv on a variable passed via URL(GET variable named times), But GoLang fails on compilation ,Show this Error: multiple-value strconv.Atoi() in a single-value context I have been trying to fix this issue for several hours. Can someone please help fix this.
asked Mar 7 Shovo210 13.3k points
0 votes
1 answer 22 views
Problem: panic: runtime error: invalid memory address or nil pointer dereference.
asked Feb 12 Dan phillip 4.7k points
0 votes
1 answer 3 views
Problem I am not finding any original dex files for dex location,help me to solve this problem.
asked 5 days ago salim1 34.8k points
0 votes
1 answer 3 views
Problem: I tried to find out the solution on the web when I face this problem but I did not get any fruitful information that I can continue if you read the above question and understand what is the solution of this please cooperate with me- Thanks
asked Mar 24 shamimkhan 15.1k points
0 votes
1 answer 1 view
1 view
Problem I'm trying to get node-key-sender running in an electron project. Every time I use node-key-sender I get a popup with 'To use the "java" command-line tool you need to install a JDK'.Can anyone help me to solve this.
asked 6 days ago neeraj 9.5k points