Start basic go project on Ubuntu17.10

前端之家收集整理的这篇文章主要介绍了Start basic go project on Ubuntu17.10前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

猜你在找的Ubuntu相关文章