Closed dpurbosakti closed 1 week ago
Could you create an example project that shows this issue between two different directories and push it to another repository on Github?
@fourstepper https://github.com/dpurbosakti/techschool_simplebank you can check it here main.go is works fine, but file in the deeper dir isnt working(air doesnt check if file is changed)
This is caused by you explicitly including "api", I am pretty sure, in your .air.toml
- https://github.com/dpurbosakti/techschool_simplebank/blob/main/.air.toml#L14
It works if you comment this line out
yes i tried to include api dir to try if its work that way,
but when i comment "include_dir" in .air.toml its still didnt work even the CLI told me they are watching my dir
proof on after edited, no mention about file changed
tried in several file in different dir still not working, only detect on main.go file
With this change, everything works as expected for me.
db/sqlc/account.sql.go has changed
building...
Processing path: /tmp/techschool_simplebank
running...
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /health-check --> simple-bank/api.NewServer.func1 (3 handlers)
[GIN-debug] POST /accounts --> simple-bank/api.(*Server).createAccount-fm (3 handlers)
[GIN-debug] GET /accounts/:id --> simple-bank/api.(*Server).getAccount-fm (3 handlers)
[GIN-debug] GET /accounts --> simple-bank/api.(*Server).listAccounts-fm (3 handlers)
[GIN-debug] PUT /accounts --> simple-bank/api.(*Server).updateAccount-fm (3 handlers)
[GIN-debug] DELETE /accounts/:id --> simple-bank/api.(*Server).deleteAccount-fm (3 handlers)
[GIN-debug] POST /transfers --> simple-bank/api.(*Server).createTransfer-fm (3 handlers)
[GIN-debug] POST /users --> simple-bank/api.(*Server).createUser-fm (3 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on 0.0.0.0:8080
is it maybe because im using WSL ?
Can't say, try replicating the bug in another environment
i've created another repo to check, and it still doesnt work.
and yes it works on windows but not in WSL
@dpurbosakti, are you making file edits from a Windows application. There's a known issue in WSL where modifications made from the native Windows environment may not trigger file modification events in the WSL Linux environment.
A workaround is to use polling by adding the following lines to your Air configuration file:
[build]
poll = true
oh nice, it works. @jtlehtinen thanks
only work at this path /mnt/d/belajar/be/go/moko/simple-bank but when i edited some file in the /mnt/d/belajar/be/go/moko/simple-bank//api/account.go air doesnt reloading
is there any way to solve this by changing .air.toml ?