GO Installation:
1. CURL GET tar, unzip in /usr/local
curl 'https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz' -o go.tar.gz \
&& sudo tar -zxvf go.tar.gz -C /usr/local \
&& sudo tar -zxvf go.tar.gz -C /usr/local \
&& sudo rm -f go.tar.gz
2. SET bash_profile, add to path, and to export $GO, $PATH variables to children programs like go
if bash never exists:
```
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH="$PATH:$HOME/.local/bin:$HOME/bin"
export GOPATH="$HOME/go"
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin:/usr/local/bin" if already there: vim ~/.bash_profile
export GOPATH="$HOME/go"
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin:/usr/local/bin"
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH="$PATH:$HOME/.local/bin:$HOME/bin"
export GOPATH="$HOME/go"
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin:/usr/local/bin" if already there: vim ~/.bash_profile
export GOPATH="$HOME/go"
export PATH="$PATH:/usr/local/go/bin:$GOPATH/bin:/usr/local/bin"
refresh
source ~/.bash_profile`
$ echo $GOPATH`
`$ echo $PATH`
`$ echo $PATH`
go version
go version go1.10.3 linux/amd64 To build the binary:
go version go1.10.3 linux/amd64 To build the binary:
```
$ go build main.go
```
To run the binary:
`$ ./main`
No comments:
Post a Comment