Clone the repo
git clone https://github.com/hanrok/godebug.git
Build the micro-service example
docker build -t godebug .
Run the service
docker run --rm -v $PWD:/build -p8080:8080 -p40000:40000 godebug
You should see output like this:
Running server
API server listening at: [::]:40000
Delve PID: 8, Server PID: 17
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
After you see this output, you need to create a new remote debug configuration in Goland (described in details in here).
Then run the debug (by click green beetle or Ctrl-D). Container output should now be with this line:
2020/03/05 20:13:32 Starting up repeater
Whenever you change your code (main.go
file) it will rebuild the image and rerun the server.