air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
18.32k stars 815 forks source link

What's the point of `root`? #603

Open pascal-mueller opened 5 months ago

pascal-mueller commented 5 months ago

I have this basic config file. I changed the root dir to cmd, not sure if that's good practice to begin with but then I figured out, I also have to manually adapt the build command and att cmd there as well. I assumed root would influence that, no?

Is that done correctly? It's hard to tell for me because the README doesn't really talk about it.

root = "./cmd"
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
  args_bin = []
  bin = "./tmp/main"
  cmd = "go build -o ./tmp/main ./cmd"
  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"]
  include_file = []
  kill_delay = "0s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  post_cmd = []
  pre_cmd = []
  rerun = false
  rerun_delay = 500
  send_interrupt = false
  stop_on_error = false

[color]
  app = ""
  build = "yellow"
  main = "magenta"
  runner = "green"
  watcher = "cyan"

[log]
  main_only = false
  time = false

[misc]
  clean_on_exit = false

[proxy]
  app_port = 0
  enabled = false
  proxy_port = 0

[screen]
  clear_on_rebuild = false
  keep_scroll = true
xiantang commented 5 months ago

we use root to find relative path of tmp dir or bin path. in your case u should set root as .