Configuring air with config file
You can cutomize Air using a .air.toml
file.
Run the following command in the project directory to generate a .air.toml
file.
air init
This will generate a .air.toml
file with the following output:
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
.air.toml
Let's take an example, set clean_on_exit
to true
, this will delete the tmp
(air stores the build binary file) folder when you exit air.
[misc]
clean_on_exit = true
Run the air command by passing the config using -c
option:
air -c .air.toml
To find the documentation of all the properties of .air.toml
read the air_example.toml file.
Thank you for reading this article šš» I hope it was helpful.