All Projects → cosmtrek → Air

cosmtrek / Air

Licence: gpl-3.0
☁️ Live reload for Go apps

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Air

hotbuild
a cross platform hot compilation tool for golang
Stars: ✭ 181 (-96.56%)
Mutual labels:  tools, live-reload, build-tool, watcher
Realize
Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.
Stars: ✭ 4,162 (-20.83%)
Mutual labels:  build-tool, watcher, task-runner
arelo
a simple auto reload (live reload) utility
Stars: ✭ 54 (-98.97%)
Mutual labels:  live-reload, task-runner, watcher
Phulp
The task manager for php
Stars: ✭ 294 (-94.41%)
Mutual labels:  watcher, task-runner
Ygor
Task toolkit. For when `npm run` isn't enough and everything else is too much.
Stars: ✭ 69 (-98.69%)
Mutual labels:  build-tool, task-runner
Mmake
Mmake is a small program which wraps make to provide additional functionality, such as user-friendly help output, remote includes, and eventually more. It otherwise acts as a pass-through to standard make.
Stars: ✭ 1,593 (-69.7%)
Mutual labels:  build-tool, task-runner
alfons
🚀 Task runner for Lua and MoonScript.
Stars: ✭ 17 (-99.68%)
Mutual labels:  task-runner, build-tool
taskctl
Concurrent task runner, developer's routine tasks automation toolkit. Simple modern alternative to GNU Make 🧰
Stars: ✭ 237 (-95.49%)
Mutual labels:  task-runner, watcher
go-docker
Sample code and dockerfiles accompanying the blog post The Ultimate Guide to Writing Dockerfiles for Go Web-apps
Stars: ✭ 89 (-98.31%)
Mutual labels:  gin, live-reload
nss-run
nss-run (not so simple run) is a very simplistic build tool.
Stars: ✭ 14 (-99.73%)
Mutual labels:  task-runner, build-tool
rote
Automate everything.
Stars: ✭ 66 (-98.74%)
Mutual labels:  task-runner, build-tool
alfred
(v0.2) Even Batman needs a little help. Task runner. Automator. Build system.
Stars: ✭ 62 (-98.82%)
Mutual labels:  task-runner, build-tool
Doit
task management & automation tool
Stars: ✭ 972 (-81.51%)
Mutual labels:  build-tool, task-runner
Cargo Make
Rust task runner and build tool.
Stars: ✭ 895 (-82.98%)
Mutual labels:  build-tool, task-runner
Foy
A simple, light-weight and modern task runner for general purpose.
Stars: ✭ 157 (-97.01%)
Mutual labels:  build-tool, task-runner
Mask
🎭 A CLI task runner defined by a simple markdown file
Stars: ✭ 495 (-90.58%)
Mutual labels:  build-tool, task-runner
gow
Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"
Stars: ✭ 343 (-93.48%)
Mutual labels:  task-runner, build-tool
Godo
golang build tool in the spirt of rake, gulp
Stars: ✭ 523 (-90.05%)
Mutual labels:  watcher, task-runner
Task
A task runner / simpler Make alternative written in Go
Stars: ✭ 4,282 (-18.55%)
Mutual labels:  build-tool, task-runner
dolphin
Automated code tool for Golang
Stars: ✭ 27 (-99.49%)
Mutual labels:  tools, gin

Air Go Codacy Badge Go Report Card codecov

☁️ Live reload for Go apps

air

Motivation

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.

Features

  • Colorful log output
  • Customize build or binary command
  • Support excluding subdirectories
  • Allow watching new directories after Air started
  • Better building process

Installation

Prefer install.sh

# 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.

Docker

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

Usage

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.

Docker-compose

services:
  my-project-with-air:
    image: cosmtrek/air
    # working_dir value has to be the same of mapped volume
    working_dir: /project-package
    ports:
      - <any>:<any>
    environment:
      - ENV_A=${ENV_A}
      - ENV_B=${ENV_B}
      - ENV_C=${ENV_C}
    volumes:
      - ./project-relative-path/:/project-package/

Debug

air -d prints all logs.

Q&A

"command not found: air" or "No such file or directory"

export GOPATH=$HOME/xxxxx
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!

Development

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 [email protected]:<YOUR USERNAME>/air.git

# 3. install dependencies
cd air
make ci

# 4. explore it and happy hacking!
make install

BTW: Pull requests are welcome~

Release new version

# 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.

Sponsor

Buy Me A Coffee

Huge thanks to the following supporters. I've always been remembering your kindness.

  • Peter Aba
  • Apostolis Anastasiou
  • keita koga

License

GNU General Public License v3.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].