-
Patrick Tafoya authoredPatrick Tafoya authored
Development Environment Setup for golang
-
Ensure a
.env
file exists at the root of<<projectName-local-dev>>
and has the required properties. Example:DEBUGGER_ARGS=--continue # (Add other variables as needed)
-
Run locally with hot reloading via Air:
docker compose up
Debugging
If running <> via the steps above, debugging is already enabled via Delve. If the env var DEBUGGER_ARGS
includes --continue
, the application will start up and then allow you to attach a debugger. However, if you want to
debug any of the initialization/startup steps (e.g. main()
, etc.), you will have
to remove --continue
from DEBUGGER_ARGS
and restart the <<projectName>>-api
container. This will halt startup until there is a
debugger attached, allowing you to debug initialization steps in the code.
To connect your IDE to the running instance, set up your debugger to connect to a Go "remote" or "server"
via port: 40000
.