Monday, September 7, 2020

Golang: go env. variables and sample program

 golang.org


env variables , bashrc:

GOROOT -- go install folder /usr/local/go

GOPATH -- top level directory of all projects ~/go/src,pkg(compiled code),bin(executable binaries)

GOBIN -- ${GOPATH}/bin -- binaries stored


keep last 2 variables to PATH variable.

To list all go env. variables

go env

hellogopher.go

~/go/src/gofullstack/hellogopher/hellogopher.go
package main
import "fmt"
func main(){
 fmt.Println("Hello Gopher!")
}

go run hellogopher.go
go install -->creates executable and installs to GOBIN directory
hellogopher


vim plugins for go:
https://github.com/fatih/vim-go

No comments:

Post a Comment