Install go
sudo add-apt-repository ppa:longsleep/golang-backports sudo apt-get update sudo apt-get install golang-go
Check go env
$ go env ... GOPATH="/home/<user>/go" GOROOT="/usr/lib/go-1.8" ...
GOPATH and GOROOT,
- GOPATH是作为编译后二进制的存放目的地和import包时的搜索路径
- GOROOT is your go install location.
There have more details for install
Install beego
Install
go get github.com/astaxie/beego
Test install
sudo nano test.go
Past this code
package main import "github.com/astaxie/beego" func main() { beego.Run() }
then
go build test.go ./test [I] http server Running on http://:8080
Finish~
Enjoy IT
原文链接:https://www.f2er.com/ubuntu/351442.html