air
air copied to clipboard
Windows file changes are not captured when dockerized
The changes made on windows are reflected inside the docker container via volumes but not capture by Air. Editing the file directly inside the docker will trigger rebuild, changes reflected on windows side also.
Got the same issue. When editing files on Windows with Goland which are mounted inside my golang:1.17 container with air installed it does not trigger the rebuild. Any ideas on how to solve this problem?
If you are running the docker engine on the WSL2, this behavior is due to the WSL2 limitation. inotify filesystem events are not propagated between WSL2 and Windows. https://github.com/microsoft/WSL/issues/4739
You can avoid inotify problem by environment variable CHOKIDAR_USEPOLLING=true
, but it may cause performance problem.
If you are running the docker engine on the WSL2, this behavior is due to the WSL2 limitation. inotify filesystem events are not propagated between WSL2 and Windows. microsoft/WSL#4739
Thanks, that's the source I think.
You can avoid inotify problem by environment variable
CHOKIDAR_USEPOLLING=true
, but it may cause performance problem.
CHOKIDAR is for nodejs from what I searched. Any solution for go?
ah... sorry, air uses fsnotify, not chokidar. as far as i know, air (and fsnotify) does not implement polling fallback. so it seems that this problem cannot be avoided.
Can anyone solve this problem ?
We are still waiting for WSL solution. Until then:
Put your Project from Windows to \\wsl$
-> {Your Distro} -> /home -> {username} / {[project_path} and NOT in /mnt/c/Users/...
Then Open the first location (\wsl$ from VSCode or editor of your choice). Save will now send the notification of the changed file
NTFS vs linux fs issue
We are still waiting for WSL solution. Until then:
Put your Project from Windows to
\\wsl$
-> {Your Distro} -> /home -> {username} / {[project_path} and NOT in /mnt/c/Users/...Then Open the first location (\wsl$ from VSCode or editor of your choice). Save will now send the notification of the changed file
NTFS vs linux fs issue
I can't find \wsl$
We are still waiting for WSL solution. Until then:
Put your Project from Windows to
\\wsl$
-> {Your Distro} -> /home -> {username} / {[project_path} and NOT in /mnt/c/Users/...Then Open the first location (\wsl$ from VSCode or editor of your choice). Save will now send the notification of the changed file
NTFS vs linux fs issue
Thanks for sharing info, I get more details to resolve windows system docker issue. The idea is enable WSL2 in your windows system, and install any Linux system such as Ubuntu.
- wsl --set-version Ubuntu 2
- Refresh docker setting -> Resouces -> WSL INTEGRATION -> enable Ubuntu
- open terminal and type wsl
- cp -r /mnt/c/Users/XXXX/projectname ~/
- code .
- docker-compose up --build
We are still waiting for WSL solution. Until then: Put your Project from Windows to
\\wsl$
-> {Your Distro} -> /home -> {username} / {[project_path} and NOT in /mnt/c/Users/... Then Open the first location (\wsl$ from VSCode or editor of your choice). Save will now send the notification of the changed file NTFS vs linux fs issueThanks for sharing info, I get more details to resolve windows system docker issue. The idea is enable WSL2 in your windows system, and install any Linux system such as Ubuntu.
- wsl --set-version Ubuntu 2
- Refresh docker setting -> Resouces -> WSL INTEGRATION -> enable Ubuntu
- open terminal and type wsl
- cp -r /mnt/c/Users/XXXX/projectname ~/
- code .
- docker-compose up --build
Can confirm this works. Thank you!
Is this problem solved?
Is this problem solved?
No, right now the solution is to move the project into the Linux filesystem in WSL.
See https://github.com/cosmtrek/air/issues/190#issuecomment-999254716
Is this problem solved?
No, right now the solution is to move the project into the Linux filesystem in WSL.
See #190 (comment)
thanks,i will take a look,hope this problem can be solved as soon as possible
Hi. I got the same issue, too.
Hugo has a fallback polling mechanism implemented. https://github.com/gohugoio/hugo/pull/8723 Could something like this be done here too ?
Hi. I got the same issue, too.
Hugo has a fallback polling mechanism implemented. gohugoio/hugo#8723 Could something like this be done here too ?
Air uses fsnotify, which is a go library for listening to file system events. fsnotify has not implemented a polling fallback feature. The issue (https://github.com/fsnotify/fsnotify/issues/9) has been in discussion since 2014; as of right now, I would recommend using an alternative like stated above until further notice.