GithubHelp home page GithubHelp logo

doytsujin / air Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosmtrek/air

0.0 1.0 0.0 30.05 MB

☁️ Live reload for Go apps

License: GNU General Public License v3.0

Makefile 2.61% Shell 21.03% Go 75.89% Dockerfile 0.47%

air's Introduction

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.

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

air's People

Contributors

178inaba avatar aaronmfz avatar bbrks avatar chihiros avatar cosmtrek avatar goenning avatar hecorr avatar heromicro avatar kyleu avatar lakexyde avatar lime008 avatar mattn avatar mikutas avatar momotaro98 avatar nickbryan avatar nickysemenza avatar polaris1119 avatar rabingaire avatar seth-shi avatar tusharsadhwani avatar tyahha avatar utamori avatar xiantang avatar zekker6 avatar zhengcan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.