Source Code for Go-Mega Tutorial
Branch | Source Code | Zip |
---|---|---|
01-Hello-World | View | Download |
02-Template-Basic | View | Download |
03-Template-Advance | View | Download |
04-Web-Form | View | Download |
05-Database | View | Download |
06-User-Login | View | Download |
07-Profile-Page-And-Avatar | View | Download |
08-Follower | View | Download |
09-Pagination | View | Download |
10-Email-Support | View | Download |
11-Facelift | View | Download |
12-Dates-And-Times | View | Download |
13-Javascript-Magic | View | Download |
14-Deployment-On-Heroku | View | Download |
15-Deployment-On-Linux | View | Download |
由于 Go 包的特殊引用方式, 最好将 code 都放到 $GOPATH/src/github.com/bonfy/go-mega-code 文件夹中再运行
请先安装 Go 环境,可以参考 Prepare
# 安装完成后 查看版本
$ go version
go version go1.11 darwin/amd64
# 建立文件夹
$ cd $GOPATH/src
$ mkdir -p github.com/bonfy
$ cd github.com/bonfy
# clone
$ git clone git@github.com:bonfy/go-mega-code.git
$ cd go-mega-code
# pull 指定分支
$ git pull origin 01-Hello-World
$ git checkout 01-Hello-World
$ go run main.go
$ go get -v github.com/bonfy/go-mega-code
# 会提示 No go files 不过不要紧,继续就可以了
# cd 到 刚才get到的文件夹
$ cd $GOPATH/src/github.com/bonfy/go-mega-code
# pull 指定分支
$ git pull origin 01-Hello-World
$ git checkout 01-Hello-World
$ go run main.go
下载每章的 zip,并解压,进入文件夹 运行
$ go run main.go