2

Im trying to install a package but get the below problem even though my ROOT directory is set properly.

p@p-ubuntu:~/ba/docker-lvm-plugin$ which go
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ echo $GOROOT
/usr/bin/go
p@p-ubuntu:~/ba/docker-lvm-plugin$ go get github.com/Sirupsen/logrus
go: cannot find GOROOT directory: /usr/bin/go
user1050619
  • 19,822
  • 85
  • 237
  • 413
  • 1
    Do not set GOROOT. – Volker Jul 06 '17 at 16:10
  • 2
    Just like in [your other question a few minutes ago](https://stackoverflow.com/questions/44952719/go-installing-package-usr-bin-go-not-a-directory), this is wrong, and [the answer is the same](https://stackoverflow.com/questions/7970390/what-should-be-the-values-of-gopath-and-goroot). – Adrian Jul 06 '17 at 16:15
  • 2
    Possible duplicate of [what should be the values of GOPATH and GOROOT?](https://stackoverflow.com/questions/7970390/what-should-be-the-values-of-gopath-and-goroot) – Adrian Jul 06 '17 at 16:15
  • 1
    Does this answer your question? [go: cannot find GOROOT directory: c:\go](https://stackoverflow.com/questions/31094751/go-cannot-find-goroot-directory-c-go) – bcmills Jul 09 '21 at 15:50

1 Answers1

3

If one issues go env then the following could be returned:

set GOPATH=C:\Users\user\go
set GOROOT=C:\tools\go

What is the GOPATH?

Create your workspace directory, %USERPROFILE%\go. (If you'd like to use a different directory, you will need to set the GOPATH environment variable; see How to Write Go Code for details.)

What is the GOROOT?

If you chose a directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.

030
  • 10,842
  • 12
  • 78
  • 123