When I get started with developing websites in Go and gin framework, it's a pitythat gin lacks live-reloading function. In fact, I tried fresh and it seems not muchflexible, so I intended to rewrite it in a better way. Finally, Air's born.In addition, great thanks to pilu, no fresh, no air :)
Air is yet another live-reloading command line utility for Go applications in development. Just air
in your project root directory, leave it alone,and focus on your code.
NOTE: This tool has nothing to do with hot-deploy for production.
# binary will be $(go env GOPATH)/bin/air
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
# or install it into ./bin/
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s
air -v
P.S. Great thanks mattn's PR for supporting Windows platform.
Please pull this docker image cosmtrek/air.
docker run -it --rm \
-w "<PROJECT>" \
-e "air_wd=<PROJECT>" \
-v $(pwd):<PROJECT> \
-p <PORT>:<APP SERVER PORT> \
cosmtrek/air
-c <CONF>
For example, one of my project runs in 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
For less typing, you could add alias air='~/.air'
to your .bashrc
or .zshrc
.
First enter into your project
cd /path/to/your_project
The simplest usage is run
# firstly find `.air.toml` in current directory, if not found, use defaults
air -c .air.toml
You can initialize the .air.toml
configuration file to the current directory with the default settings running the following command.
air init
After this you can just run the air
command without additional arguments and it will use the .air.toml
file for configuration.
air
For modifying the configuration refer to the air_example.toml file.
air -d
prints all logs.
export GOPATH=$HOME/xxxxx
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!
Please note that it requires Go 1.13+ since I use go mod
to manage dependencies.
# 1. fork this project
# 2. clone it
mkdir -p $GOPATH/src/github.com/cosmtrek
cd $GOPATH/src/github.com/cosmtrek
git clone git@github.com:<YOUR USERNAME>/air.git
# 3. install dependencies
cd air
make ci
# 4. explore it and happy hacking!
make install
BTW: Pull requests are welcome~
# 1. checkout to master
git checkout master
# 2. add the version that needs to be released
git tag v1.xx.x
# 3. push to remote
git push origin v1.xx.x
the ci will processing and will release new version,wait about 5 min you can fetch the new version.
Huge thanks to the following supporters. I've always been remembering your kindness.
Air Datepicker 是一个轻量级跨浏览器的 jQuery 日期选择器和 css-flexbox。
Adobe Integrated Runtime (AIR) 是一个跨操作系统的运行时,利用现有的Web开发技术(Flash,Flex,HTML,JavaScript,Ajax)来构建富Internet应用程序并部署为桌面应用程序。 AIR 支持现有的Web技术如Flash,Flex,HTML,JavaScript和AJAX,可以用你最熟练的技术来开发您所见过的最具用户体验的RIA程序。 AIR
homebridge-philips-air Homeridge Plugin for Philips Air Purifiers �� Foreword �� This plugin is now using py-air-control directly to enable support for newer Philips connected air purifier models. ��
FriBox Air Sensor 是开源空气质量监测仪/传感器,由 Esp32 + Micropython + PMS5003ST + HmiLcd 组成。 硬件组成 ESP32 -- Wifi蓝牙开发板 / ESP32 Micropython 开发板 PMS5003ST -- 攀藤颗粒物甲醛温湿度传感器 / 颗粒物 甲醛 温湿度 TJC4832T035_011 -- 串口触摸屏 / inc
homebridge-panasonic-air-conditioner Panasonic Air Conditioner / Heat Pump plugin for HomeBridge using the Panasonic Comfort Cloud API to expose Panasonic Air Conditioners to Apples HomeKit. Things to
homebridge-xiaomi-air-purifier This project is forked from homebridge-mi-air-purifier. This is Xiaomi Mi Air Purifier plugin for Homebridge. Since Apple Homekit doesn't support air purifier on iOS 10,