I've just installed Go and I can't get my go install
working. I followed a tutorial on YouTube to write a HelloWorld.go app but I keep getting the error:
go install: no install location for directory /Users/####/Documents/Dev/go/src/github.com/####/hello outside GOPATH
Here is my go env
:
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/####/Documents/Dev/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
In the tutorial that I was following the persons GOPATH was also set to a folder and then I was meant to create the folders /src/github.com/.....etc and then run go install
in the directory with my code. Here's the code, although I imagine that not much could be wrong with the code:
package main
import "fmt"
func main() {
fmt.Println("Hello, world!");
}
When I run the pwd
command inside the directory with my code, this is the output:
/Users/####/Documents/Dev/go/src/github.com/####/hello
When I run the echo $GOPATH
command inside the directory with my code, this is the output:
/Users/####/Documents/Dev/go
I am running Mac OSX Yosemite.