Air
☁️ Live reload for Go apps
Under GNU General Public License v3.0
By cosmtrek
☁️ Live reload for Go apps
Under GNU General Public License v3.0
By cosmtrek
Air
:cloud: Live reload for Go apps
When I get started with developing websites in Go and gin framework, it's a pity
that gin lacks live-reloading function. In fact, I tried fresh and it seems not much
flexible, 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.
```bash
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/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.
bash
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:
bash
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
bash
cd /path/to/your_project
The simplest usage is run
```bash
.air.toml
in current directory, if not found, use defaultsair -c .air.toml
```
You can initialize the .air.toml
configuration file to the current directory with the default settings running the following command.
bash
air init
After this you can just run the air
command without additional arguments and it will use the .air.toml
file for configuration.
bash
air
For modifying the configuration refer to the air_example.toml file.
air -d
prints all logs.
zsh
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.
```bash
mkdir -p $GOPATH/src/github.com/cosmtrek
cd $GOPATH/src/github.com/cosmtrek
git clone [email protected]:/air.git
cd air
make ci
make install
```
BTW: Pull requests are welcome~
```
git checkout master
git tag v1.xx.x
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.
GNU General Public License v3.0