Why doesn't Debug in Goland?

Here's the code I have

package main

import (
"github.com/go-chi/chi"
"log"
"net/http"
"os"
"os/signal"
)

var DB map[string]string

func main() {

 stopchan := make(chan os.Signal)

 router := chi.NewRouter()

 router.Route("/", func(r chi.Router) {
 r.Get("/", GetIndexHandler)
 r.Post("/", GetPostIndexHandler)
})

 go func() {
 err := http.ListenAndServe(":8080", router)
log.Fatal(err)
}()

 signal.Notify(stopchan, os.Kill, os.Interrupt)

<-stopchan
}

GetIndexHandler func(w http.ResponseWriter, r *http.Request) {
 key := chi.URLParam(r, "key")
 value, exists := DB[key]

 if exists {
w.Write([]byte(value))
 } else {
w.WriteHeader(http.StatusNotFound)
}
}

GetPostIndexHandler func(w http.ResponseWriter, r *http.Request) {
 key := chi.URLParam(r, "key")
 value := chi.URLParam(r, "value")
 DB[key] = value
w.WriteHeader(http.StatusCreated)
w.Write([]byte(value))
}


I want to make a stop at the time the post request to the server. Add a stop in the appropriate place:
5e43fcc0c4f4b957574372.png
Launch Run -> Debug

Shows like this:
5e43fd26b3471336398754.png

Strictly speaking, I never used this, and just output values to the console. But now for the first time needed and it is not clear how to set. Can I to do something in this situation to make the breakpoint and I could see the current values of variables? Thank you for your answer.
April 7th 20 at 11:22
1 answer
April 7th 20 at 11:24
Solution
Because your app crashes at startup. And even the error that port 8080 is busy.
thank you, got sidetracked, will try in the near future to deal - Emma63 commented on April 7th 20 at 11:27

Find more questions by tags GoGoLand