Operating system: Ubuntu 14.04
lines in the .bashrc (tried both of the following)
# GoPath (without goroot)
export GOPATH=$HOME/gowork
...
# GoPath (with goroot)
export GOROOT=/usr/local/go
export GOPATH=$HOME/gowork
Note: I tried to set the above environment variables, first in .profile and then in .bashrc as suggested by different people in a different way.
Tried to run the following code
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
Error message in the terminal
go run helloworld.go
helloworld.go:3:8: cannot find package "fmt" in any of:
/usr/local/go/src/pkg/fmt (from $GOROOT)
/home/arif/gowork/src/fmt (from $GOPATH)
package runtime: cannot find package "runtime" in any of:
/usr/local/go/src/pkg/runtime (from $GOROOT)
/home/arif/gowork/src/runtime (from $GOPATH)
edit
go env output
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/arif/gowork"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
go version output
go version go1.3.3 linux/amd64
A hint
I remember that the tar I installed from was go1.6.linux-amd64.tar.gz, which means the go version 1.6 should be shown but my terminal is outputting 1.3.3.