Go语言环境和路径

I have few apps cloned from github, but not sure if I do everything right. I recently installed go.

$ go
Go is a tool for managing Go source code.

Usage:

        go command [arguments]

The commands are:

        build       compile packages and dependencies
        clean       remove object files
        doc         show documentation for package or symbol
        env         print Go environment information
        fix         run go tool fix on packages
        fmt         run gofmt on package sources
        generate    generate Go files by processing source
        get         download and install packages and dependencies
        install     compile and install packages and dependencies
        list        list packages
        run         compile and run Go program
        test        test packages
        tool        run specified go tool
        version     print Go version
        vet         run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

        c           calling between Go and C
        buildmode   description of build modes
        filetype    file types
        gopath      GOPATH environment variable
        environment environment variables
        importpath  import path syntax
        packages    description of package lists
        testflag    description of testing flags
        testfunc    description of testing functions

Use "go help [topic]" for more information about that topic.

And I have things configured accordingly (exported variables etc..) also added them into ~/.bashrc however I still need to change directory and go to my go/bin folder.. is this what all are doing or there is something I can change. Would be great if you can point me on some sort of docs (not go lang please!).

I am on Mac OS X.

Verify that the binary you are trying to run is in your $GOPATH/bin directory, e.g. it should appear when you run ls $GOPATH/bin

Next, verify that $GOPATH/bin is in your $PATH, e.g. it should appear with echo $PATH. If this $GOPATH/bin is not in your $PATH, add it e.g. export PATH=$GOPATH/bin:$PATH (you may want to add this to your .bashrc).

You can run go env to see your $GOPATH and some environment variable

In Mac OS X, open terminal

create a .profile file

touch .profile

edit it

vim .profile

add this to your first line

export GOPATH=$HOME/work/ or whatever directory your Go files are in

save :w and quit :q

restart terminal

change to your new GOPATH/bin directory to confirm

cd $GOPATH/bin