I'm trying to install doozer like this:
$ goinstall github.com/ha/doozer
I get these errors.
goinstall: os: go/build: package could not be found locally goinstall: fmt: go/build: package could not be found locally goinstall: io: go/build: package could not be found locally goinstall: reflect: go/build: package could not be found locally goinstall: math: go/build: package could not be found locally goinstall: rand: go/build: package could not be found locally goinstall: url: go/build: package could not be found locally goinstall: net: go/build: package could not be found locally goinstall: sync: go/build: package could not be found locally goinstall: runtime: go/build: package could not be found locally goinstall: strings: go/build: package could not be found locally goinstall: sort: go/build: package could not be found locally goinstall: strconv: go/build: package could not be found locally goinstall: bytes: go/build: package could not be found locally goinstall: log: go/build: package could not be found locally goinstall: encoding/binary: go/build: package could not be found locally
GOROOT and GOPATH are environment variables that define this layout. GOROOT is a variable that defines where your Go SDK is located. You do not need to change this variable, unless you plan to use different Go versions. GOPATH is a variable that defines the root of your workspace.
GOPATH is an environment variable that is used to specify the root of your Go workspace. By default, the workspace located at %USERPROFILE%/go for Windows. To configure GOPATH follow the steps mentioned below: Create a new folder in your C drive called "C:\Projects\Go".
The GOPATH environment variable specifies the location of your workspace. It defaults to a directory named go inside your home directory, so $HOME/go on Unix, $home/go on Plan 9, and %USERPROFILE%\go (usually C:\Users\YourName\go ) on Windows.
Default GOPATH is: $HOME/go on Unix-like systems. %USERPROFILE%\go on Windows.
GOPATH
is discussed in the cmd/go
documentation:
The
GOPATH
environment variable lists places to look for Go code. On Unix, the value is a colon-separated string. On Windows, the value is a semicolon-separated string. On Plan 9, the value is a list.
GOPATH
must be set to get, build and install packages outside the standard Go tree.
GOROOT
is discussed in the installation instructions:
The Go binary distributions assume they will be installed in
/usr/local/go
(orc:\Go
under Windows), but it is possible to install the Go tools to a different location. In this case you must set theGOROOT
environment variable to point to the directory in which it was installed.For example, if you installed Go to your home directory you should add the following commands to
$HOME/.profile
:export GOROOT=$HOME/go export PATH=$PATH:$GOROOT/bin
Note:
GOROOT
must be set only when installing to a custom location.
(updated version of Chris Bunch's answer.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With