I have to say that Visual Studio Code, for all its pros and cons for various language, it's a totally awesome IDE for Go. Sure, Golang is great in ...
For further actions, you may consider blocking this person and/or reporting abuse
In my case, this is working but with 1 issue: every time I changed a file, the debugger "Delve into Docker" will get terminated due to its target port being reset by air.
Does anyone know any setting that can prevent the remote debugger from stopping when change occurs?
That almost worked for me, but then I get
server failed to start: listen tcp :8080: bind: address already in use
when the hot reload happens. There is some sort of problem with Air and I can't figure out what it is.There has to be something that kills the previous running server somehow.
This is not working on Chip Apple M1 Pro.
I have been looking for more information but almost every configuration is similar to this but when I set a breakpoint or several breakpoints, those are not working I request using postman and the server responds as if there were no breakpoints.
Any ideas that can help me?
strange, this still works for me. Although in the time since my original post, I've noticed that after rebuild on changes I need to restart the debugger.
I'm experiencing the same thing with delve, air and vscode.
Each time I make changes to a file, the vscode debugger gets disconnected because delve process terminates, and spawns a new process.
Hey! Thanks for nice guide! Question though: when I use the exact setup above, my changes does not seem to be reflected when air reloads. It is reloading, but the changes are not there. I checked the docker-container and the files indeed were changed. If I removed delve from the equation, it works like a charm. Thoughts?
Hm, I can't say I have this behaviour. I've updated my setup to Go 1.17 and running under Mac with latest air and delve I do have another issue, which is that while the reload works ok, the debug session needs to be manually stopped and restarted while clearing the breakpoints - which is another issue at the moment.
What is your setup like (OS, Docker version?)
i also have this problem, am using version 1.18, i thought it could be the that i wasn't following graceful shutdown procedure but i did whats on gin-gonic examples and that did not fixed it. I am getting this warning
2022/03/29 19:33:38 listen: listen tcp :8080: bind: address already in use
I changed 8181 port for 8080. I haven't tested breakpoints for Goland IDE.
@andreidascalu I have a configuration like that & both air & delve is working properly. However, there is a use case that I can't debug, which is related to a logic that should run as a first step when my program starts. The problem is that once I run the Air command and the server is up, I don't have enough time to go to VS Code and set the breakpoint. Do you know how I could debug a scenario like this ?
Removing --continue would solve that issue but would like to know if you have any other alternative
You're missing the -c .air.toml to run using the config you created in the CMD (or in a command: field in the docker-compose).
Other than that, the guide worked perfectly. Fantastic guide. Before I knew about air, I had tried to setup remote debugging myself and I also wasted a lot of time until I discovered the substitutePath trick. Thanks a bunch.
Really nice setup. I've tried it even with another hot loading library (github.com/githubnemo/CompileDaemon) and it still can work by the general way. Thanks so much!!