多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] [github](https://github.com/cosmtrek/air/) ## 安装 ### macOS ``` curl -fLo ~/.air https://raw.githubusercontent.com/cosmtrek/air/master/bin/darwin/air chmod +x ~/.air ``` ### Linux ``` curl -fLo ~/.air https://raw.githubusercontent.com/cosmtrek/air/master/bin/linux/air chmod +x ~/.air ``` ### Windows ``` curl -fLo ~/.air.exe https://raw.githubusercontent.com/cosmtrek/air/master/bin/windows/air.exe ``` ### docker ``` docker run -it --rm \ -w "/go/src/github.com/cosmtrek/hub" \ -v $(pwd):/go/src/github.com/cosmtrek/hub \ -p 9090:9090 \ cosmtrek/air ``` ## 使用 > [默认配置](https://github.com/cosmtrek/air/raw/master/air.conf.example) 在项目根路径 添加 .air.conf文件 <details> <summary> .air.conf</summary> ``` # . or absolute path, please note that the directories following must be under root root = "." # Optional! If `watch_dir` is empty, use `root`. watch_dir = "" tmp_dir = "tmp" [build] # Just plain old shell command. You could use `make` as well. cmd = "go build -o tmp/antbiz.exe antbiz.go" # Binary file yields from `cmd`. bin = "tmp/antbiz.exe" # Customize binary. #full_bin = "APP_ENV=dev APP_USER= tmp/antbiz.exe" log = "air_errors.log" include_ext = ["go", "tpl", "tmpl", "html"] exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"] delay = 1000 # ms [log] time = false [color] main = "magenta" watcher = "cyan" build = "yellow" runner = "green" [misc] clean_on_exit = true ``` </details> `执行 air`