Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go get: no install location for directory /opt/gobuster outside GOPATH #82

Closed
kerbroasted opened this issue Jun 1, 2018 · 4 comments
Closed

Comments

@kerbroasted
Copy link

When running: sudo go get && go build from /opt/gobuster/ I get the following

go get: no install location for directory /opt/gobuster outside GOPATH
For more details see: 'go help gopath'

@AnotherWayIn
Copy link

try without sudo and cd into /gobuster then go build

@codingo
Copy link

codingo commented Jun 28, 2018

In main.go you'll notice the following:

import (
	"flag"
	"fmt"

	"github.com/OJ/gobuster/libgobuster"
)

Specifically, this line:

github.com/OJ/gobuster/libgobuster

What this is doing when you do a go build is checking for the library:

$GOPATH/github.com/OJ/gobuster/libgobuster

Typically, your gopath will default to /go/ under your home directory. So, if you're on kali linux and you've done a barebone go install, that path will be /root/go/.

There's a few solutions to this:

  • Change your gopath
  • Have the repositories in both gopath and opt
  • Move your program to your gopath

Option 1 is fairly easy for you to google, as it option 3. Since option 2 accomplishes what you are asking here, let's focus on that:

Gathering Dependencies

To add the gobuster dependencies to your gopath, you do the following:

go get github.com/OJ/gobuster

Build the application

You can then do a go build in your opt folder, and it will work.

Updating

If you take this approach you can't simply git pull and rebuild when updates come out. If you take this route each time you'll need to also update the second location, in your gopath, using the following:

go get -u github.com/OJ/gobuster

@OJ
Copy link
Owner

OJ commented Jul 5, 2018

Thanks @codingo for handling this one.

@OJ OJ closed this as completed Jul 5, 2018
@ranzbak
Copy link

ranzbak commented Dec 10, 2019

For me it worked to execute :
export GOBIN=$GOPATH/bin
This got rid of the error:
go get: no install location for directory /X/ outside GOPATH For more details see: 'go help gopath'
I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants