## 安裝 Mix Go
> 安裝開發工具,兩種方法二選一
使用 `go get` 安裝,優點是可以使用代理加速。
~~~
// 快速安裝
go get github.com/mix-go/mix
// 如果安裝時提示版本異常,增加 -u 參數
go get -u github.com/mix-go/mix
// 也可以安裝 master 分支的最新代碼
go get -u github.com/mix-go/mix@master
~~~
源碼安裝
~~~
git clone https://github.com/mix-go/mix
cd mix
go install
~~~
## 創建項目
創建應用骨架
> 當提示 go get *** 異常時,手動執行重試一下,還無法解決就截圖去官方群
- console
~~~
mix new --name=hello
~~~
- api
~~~
mix api --name=hello
~~~
- web (含websocket)
~~~
mix web --name=hello
~~~
- grpc
~~~
mix grpc --name=hello
~~~
## 編譯
>[danger] 使用 `Goland` 的用戶在編輯器中使用 `Run` 菜單替代下面的過程
- 編譯到骨架的 `bin` 目錄,**注意:必須編譯到該目錄,Goland 默認是編譯到緩存目錄,這樣會讀取不到 .env 等配置文件而拋出異常。**
~~~
cd hello
go build -o bin/go_build_main_go main.go
~~~
- 執行
Win
~~~
cd bin
go_build_main_go.exe
~~~
Linux & macOS
~~~
cd bin
./go_build_main_go
~~~