JRehkemper.de

Use Air for Live-Reload in Go-Projects

Air is a tool comparable to nodemon for nodejs. It reloads your development server everytime you change you code. This can be quite handy.

Installation

You can simply install it as a go package.

go install github.com/cosmtrek/air@latest

After that it is placed in you GoPath.
If you don’t know where this is, print the Variable to the Terminal.

echo $GOPATH

For faster access you can create an alias.

alias air='~/go/bin/air'

and to make it permanent use your .bashrc

alias air='~/go/bin/air' >> ~/.bashrc

Usage

To use it you will first need to create a configuration file for it. The default will work in most cases.

air init

After that you can run you Project like this.

air
profile picture of the author

Jannik Rehkemper

I'm an professional Linux Administrator and Hobby Programmer. My training as an IT-Professional started in 2019 and ended in 2022. Since 2023 I'm working as an Linux Administrator.