• Register
0 votes
562 views

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.7K views
2.7K 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 19 views
19 views
How would I refresh this project after modifying the React JavaScript code in the parent folder?
asked Dec 27, 2020 TeamScript 11.1k points
0 votes
1 answer 884 views
884 views
Problem : Getting bellow error related to curses in python code curses is not supported on this machine (please install/reinstall curses for an optimal experience)
asked Nov 7, 2019 peterlaw 6.9k points
0 votes
1 answer 10 views
10 views
I wonder which part went wrong. Thanks in advance.
asked Jan 4 TeamScript 11.1k points
1 vote
1 answer 27 views
27 views
GOPATH is DIR. Created folders for src, bin and pkg under DIR. There is a package in /DIR/src/lib/ as lib.go. The GOBIN value is set to /DIR/bin. When I try to run go install lib.go from /DIR/src/lib it says the error "go install: no install ... on command line (GOBIN not set)". I listed my environment variables using "go env". Both the GOPATH and GOBIN values are set correctly. Please help
asked May 6, 2020 anonymous
2 votes
2 answers 267 views
267 views
Problem: What command line utility can be used to repair the BCD on a Windows installation?
asked Mar 23, 2020 ArifulIslam 5.6k points
0 votes
1 answer 19 views
19 views
Problem: Can anyone guide me with right command to be used for monitoring free space on mounted filesystems? Which command below provides the easiest method for monitoring free space on mounted filesystems? - du - df - fs - fd
asked Feb 19, 2020 maddi86 5.4k points
1 vote
1 answer 46 views
46 views
Problem : I am very new to Linux and currently trying to learn Linux. I want to login to my elementaryOS but I am stuck in the loop I simply tried to enter my password and after that I tried to press enter and I was back to login again. I also tried to enter my ... after spending lot of time and efforts on it still unable to fix it so now I am looking for the Linux experts help to fix above error.
asked May 1, 2020 stewart 4k points
0 votes
2 answers 67 views
67 views
While using asp.net everything looks fine to me but this tiny little annoying error message. Does it come from the browser? or from other sources? it looks like – xml parsing error: no root element found Location: ....... Any help would be appreciated as I’m still a beginner. Thanks.
asked Mar 9, 2020 LizzyM 6.1k points