I am not a Go programmer, but I do try out some projects, so I want to keep some notes just in case that I might forget how to run them next time.
1 Go Installation
The following is the paths I use, set in Bash:
export GOROOT=$HOME/var/bin/go export GOPATH=$HOME/.local/lib64/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Unpack Go binary to $GOROOT. Any Go packages will be installed under $GOPATH, which will be used like Python’s user scheme, since it’s in my $HOME.
2 Running a code
If just to try out, then it’s better to set up a $GOPATH just for it:
mkdir /tmp/tmpgo export GOPATH=/tmp/tmpgo export PATH=$GOPATH/bin:$PATH go get <URL> <command> go run <name>.go
This creates a directory only for the code, once done, it can be removed safely and ends the shell.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.