└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Go-Mega Code 2 | 3 | Source Code for [Go-Mega Tutorial](https://github.com/bonfy/go-mega) 4 | 5 | 6 | ## Branch列表 7 | 8 | | Branch | Source Code | Zip | 9 | | :--- | :--- | :--- | 10 | | 01-Hello-World | [View](https://github.com/bonfy/go-mega-code/tree/01-Hello-World) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.1.zip)| 11 | | 02-Template-Basic | [View](https://github.com/bonfy/go-mega-code/tree/02-Template) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.2.zip)| 12 | | 03-Template-Advance | [View](https://github.com/bonfy/go-mega-code/tree/03-Template-Advance) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.3.zip) | 13 | | 04-Web-Form | [View](https://github.com/bonfy/go-mega-code/tree/04-Web-Form) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.4.zip) | 14 | | 05-Database | [View](https://github.com/bonfy/go-mega-code/tree/05-Database) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.5.zip) | 15 | | 06-User-Login | [View](https://github.com/bonfy/go-mega-code/tree/06-User-Login) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.6.zip) | 16 | | 07-Profile-Page-And-Avatar | [View](https://github.com/bonfy/go-mega-code/tree/07-Profile-Page) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.7.zip) | 17 | | 08-Follower | [View](https://github.com/bonfy/go-mega-code/tree/08-Follower) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.8.zip) | 18 | | 09-Pagination | [View](https://github.com/bonfy/go-mega-code/tree/09-Pagination) | [Download](https://github.com/bonfy/go-mega-code/archive/v0.9.zip)| 19 | | 10-Email-Support | [View](https://github.com/bonfy/go-mega-code/tree/10-Email-Support) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.0.zip)| 20 | | 11-Facelift | [View](https://github.com/bonfy/go-mega-code/tree/11-Facelift) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.1.zip) | 21 | | 12-Dates-And-Times | [View](https://github.com/bonfy/go-mega-code/tree/12-Dates-And-Times) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.2.zip) | 22 | | 13-Javascript-Magic | [View](https://github.com/bonfy/go-mega-code/tree/13-Javascript-Magic) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.3.zip) | 23 | | 14-Deployment-On-Heroku | [View](https://github.com/bonfy/go-mega-code/tree/14-Deployment-On-Heroku) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.4.zip) | 24 | | 15-Deployment-On-Linux | [View](https://github.com/bonfy/go-mega-code/tree/15-Deployment-On-Linux) | [Download](https://github.com/bonfy/go-mega-code/archive/v1.5.zip) | 25 | 26 | ## 如何使用 27 | 28 | > 由于 Go 包的特殊引用方式, 最好将 code 都放到 $GOPATH/src/github.com/bonfy/go-mega-code 文件夹中再运行 29 | 30 | 31 | #### 准备 32 | 33 | 请先安装 Go 环境,可以参考 [Prepare](https://go-mega.bonfy.im/00-prepare) 34 | 35 | ```cmd 36 | # 安装完成后 查看版本 37 | $ go version 38 | go version go1.11 darwin/amd64 39 | ``` 40 | 41 | #### Git 方式 42 | 43 | ```cmd 44 | # 建立文件夹 45 | 46 | $ cd $GOPATH/src 47 | $ mkdir -p github.com/bonfy 48 | $ cd github.com/bonfy 49 | 50 | # clone 51 | 52 | $ git clone git@github.com:bonfy/go-mega-code.git 53 | $ cd go-mega-code 54 | 55 | # pull 指定分支 56 | 57 | $ git pull origin 01-Hello-World 58 | $ git checkout 01-Hello-World 59 | $ go run main.go 60 | ``` 61 | 62 | #### Go Get 方式 63 | 64 | ```cmd 65 | $ go get -v github.com/bonfy/go-mega-code 66 | 67 | # 会提示 No go files 不过不要紧,继续就可以了 68 | 69 | # cd 到 刚才get到的文件夹 70 | 71 | $ cd $GOPATH/src/github.com/bonfy/go-mega-code 72 | 73 | # pull 指定分支 74 | 75 | $ git pull origin 01-Hello-World 76 | $ git checkout 01-Hello-World 77 | $ go run main.go 78 | 79 | ``` 80 | 81 | #### Download Zip方式 82 | 83 | 下载每章的 zip,并解压,进入文件夹 运行 84 | 85 | ```cmd 86 | $ go run main.go 87 | ``` 88 | 89 | 90 | ## 支持我 91 | 92 | ![support](https://github.com/bonfy/go-mega/blob/master/images/sponsor.jpg?raw=true) 93 | 94 | 95 | --------------------------------------------------------------------------------