Skip to content
陳鍾誠 edited this page Mar 1, 2018 · 3 revisions

Go 語言

Linux

$ sudo apt-get install golang-go // 在我電腦上是安裝 go-1.6
...

root@ubuntu-512mb-sgp1-01:~/ccc/go# ls /usr/lib/go-1.6
bin  pkg  src  test  VERSION
root@ubuntu-512mb-sgp1-01:~/ccc/go# ls /usr/lib/go-1.6/bin
go  gofmt
root@ubuntu-512mb-sgp1-01:~/ccc/go# ls /usr/lib/go-1.6/bin

要安裝更新版,請用下列方式:

root@ubuntu-512mb-sgp1-01:~/ccc/go# go version
-bash: /usr/bin/go: No such file or directory
root@ubuntu-512mb-sgp1-01:~/ccc/go# sudo vim /root/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# sudo vim /root/.bashrc
root@ubuntu-512mb-sgp1-01:~/ccc/go# go version
-bash: /usr/bin/go: No such file or directory
root@ubuntu-512mb-sgp1-01:~/ccc/go# sudo vim /root/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
root@ubuntu-512mb-sgp1-01:~/ccc/go# sudo vim /root/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# source ~/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
root@ubuntu-512mb-sgp1-01:~/ccc/go# go
Go is a tool for managing Go source code.

Usage:

        go command [arguments]

設定 GOPATH

root@ubuntu-512mb-sgp1-01:~/ccc/go# vim ~/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# source ~/.profile
root@ubuntu-512mb-sgp1-01:~/ccc/go# echo $GOPATH
/root/ccc/go

Go 和 WebAssembly