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

Live reload not working correctly with devcontainers #631

Open
vitezprchal opened this issue Jul 29, 2024 · 3 comments
Open

Live reload not working correctly with devcontainers #631

vitezprchal opened this issue Jul 29, 2024 · 3 comments

Comments

@vitezprchal
Copy link

Hi there,

Air only watches the directory it is being run in. For instance, when I run air in the /cmd directory, it only watches the /cmd directory and does not detect changes in any other directories or subdirectories.

Steps:

  • Set up a go project with multiple directories (e.g., /cmd, /internal, etc.).
  • Configure a devcontainer in vscode.
  • Run air within one of the subdirectories, such as /cmd.
  • Make changes in other directories or subdirectories.
  • Air does not detect changes outside the /cmd directory.

Environment:

  • Go version: go1.22.5 linux/amd64
  • air version: v1.52.3

I'm using the default configuration provided.
I've also tried enabling proxies.

Is there a known workaround for this issue when using devcontainers?

@LandSprutte
Copy link

Having similar problems on my mac. It rebuild when I save the file, but doesnt refresh in the browser

@rweir
Copy link

rweir commented Sep 10, 2024

Run air within one of the subdirectories, such as /cmd.

can't you just not do that? air should just be run in the root of the project, then you just configure it to ignore things you don't want, for example:

exclude_dir = ["assets", "tmp", "vendor", "testdata"]

you will need to write a config file.

@WorldLibMi
Copy link

I have a similar issue with go 1.22.9 on an alpine devcontainer. The air version that can be installed is v1.52.3, the newer ones need a newer go version, but that has not been incorporated yet into the apk distribution.

The behavior I observe is that it works for the root project directory if and only if the directive include_dir is not present in the file .air.toml. Whenever I add this directive, even if it is include_dir = [ "./" ], air is not considering anything in the watch list anymore:

without the directive:

image

with the directive (doesn't matter what value it has):

image

My purpose is to make it watch to other folders, like ../target/static, i.e. for files that are not produced by this project, but by a sibling.

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

4 participants