Windows 下装置Air
go env -w GOPROXY=https://goproxy.cn,directgo env -w GO111MODULE=ongo install github.com/cosmtrek/air@latest
装置当前,门路退出环境变量配置.
2.我的项目配置
在我的项目的根目录下创立文件 .air.conf
root = "."tmp_dir = "tmp"[build]# 只须要写你平时编译应用的shell命令。你也能够应用 `make`cmd = "go build -o main.exe ."# 由`cmd`命令失去的二进制文件名bin = "main.exe"# 自定义执行程序的命令,能够增加额定的编译标识例如增加 GIN_MODE=releasefull_bin = "main.exe"# 监听以下文件扩展名的文件.include_ext = ["go", "tpl", "tmpl", "html"]# 疏忽这些文件扩展名或目录exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"]# 监听以下指定目录的文件include_dir = []# 排除以下文件exclude_file = []# 如果文件更改过于频繁,则没有必要在每次更改时都触发构建。能够设置触发构建的延迟时间delay = 1000 # ms# 产生构建谬误时,进行运行旧的二进制文件。stop_on_error = true# air的日志文件名,该日志文件搁置在你的`tmp_dir`中log = "air_errors.log"[log]# 显示日志工夫time = true[color]# 自定义每个局部显示的色彩。如果找不到色彩,应用原始的应用程序日志。main = "magenta"watcher = "cyan"build = "yellow"runner = "green"[misc]# 退出时删除tmp目录clean_on_exit = true
3.应用命令air启动我的项目air.exe -c .air.conf
4、测试
批改代码并保留批改(ctrl+s)
air会自动检测的批改,从新加载我的项目.
参考: http://t.zoukankan.com/ztshua...