go项目有两种常用的热加载工具,fresh,Air。其中Air更优秀
1. Air
https://github.com/cosmtrek/air
用法
安装Air
go install github.com/cosmtrek/air@latest
进入到项目路径
cd /path/to/your_project
简单的运用
# 优先在当前路径查找 `.air.toml` 后缀的文件,如果没有找到,则使用默认的
air -c .air.toml
可以运行以下命令初始化,把默认配置添加到当前路径下的.air.toml 文件。在这之后,你只需执行 air 命令,无需添加额外的变量,它就能使用 .air.toml 文件中的配置了。
air init
2. fresh
https://github.com/gravityblast/fresh
用法
安装
go get github.com/pilu/fresh
进入到项目路径
cd /path/to/myapp
启动
fresh