Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot Reload not working for changes on main.go #568

Open
JonPichel opened this issue Apr 12, 2024 · 2 comments
Open

Hot Reload not working for changes on main.go #568

JonPichel opened this issue Apr 12, 2024 · 2 comments

Comments

@JonPichel
Copy link

Hi,

I am using the air version packaged in nixpkgs. My operating system is NixOS. This is the version that gets returned on air -v: (devel), built with Go [email protected].

This is my .air.toml file:

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

[build]
  args_bin = []
  bin = "./tmp/main"
  cmd = "go build -o ./tmp/main ."
  delay = 0
  exclude_dir = ["node_modules", "assets", "tmp", "vendor", "testdata"]
  exclude_file = []
  exclude_regex = ["_test.go"]
  exclude_unchanged = false
  follow_symlink = false
  full_bin = ""
  include_dir = [".", "internal"]
  include_ext = ["go"]
  include_file = ["main.go"]
  kill_delay = "0s"
  log = "build-errors.log"
  poll = false
  poll_interval = 0
  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

[screen]
  clear_on_rebuild = false
  keep_scroll = true

As you can see I tried several things to include main.go, but nothing is working. When I run air it reports that it is watching main.go, but when I change the contents of the file it doesn't reload.

It does however detect changes in any file in the internal/ directory.

I assume this is a problem with the version packaged by nixpkgs, but maybe my configuration is not correct.

@edersohe
Copy link

It seems to I have the same issue, but when i set config file flag

air -c .air.toml

It works!

air v1.51.0, built with Go go1.22.2

@JonPichel
Copy link
Author

It doesn't work for me that way either. Maybe it is due to the Nix package using the (devel) version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants