I've placed my path variables as follows:
export GOROOT=/usr/local/go
export GOPATH=$HOME/Professional/Sch/Fabric/go
export GOBIN=/usr/local/go/bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
I've placed these lines in both ~/.profile and ~/.bashrc and sourced them both (not sure which of them is taking effect).
my go env output:
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="/home/deepak/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/deepak/Professional/Sch/Fabric/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build653871525=/tmp/go-build -gno-record-gcc-switches"
I've placed the following code in $HOME/Professional/Sch/Fabric/go/hellp.go:
package main
import "fmt"
func main() {
fmt.Printf("Hello, World!
")
}
but each time i do go install hellp.go
, I get:
go install command-line-arguments: open /usr/local/go/bin/hellp: permission denied
which is strange because go version
returns a go version go1.10.4 linux/amd64
, and I'm not sure why its trying to reference /usr/local/go/bin/hellp
as there is no 'hellp' file there, its a sample file I created at $HOME/Professional/Sch/Fabric/go/
.
I'm not sure which directory permission is missing, but I've tried:
201 sudo chmod -R 777 ~/Professional/Sch/Fabric
202 go install hellp.go
203 sudo chmod -R 777 ~/Professional/Sch/Fabric/go/hellp.go
204 go install hellp.go
205 sudo chmod -R 777 ~
My uname -a output:
Linux instance-1 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux
I'm trying to install HyperLedger Fabric for which Go is a prerequisite, and clearly go version
output shows its successfully installed, however, I'm not sure where or how it needs to be configured to test and use it.