I'm reading "The Way to Go" book and while I understand most, I'm having a difficulty with the following.

The author mentions a way to wrap a HandleFunc in a closure that takes care of panics like so:

```
func Index(w http.ResponseWriter, req *http.Request) {
    w.Header().Set("Content-Type", "text/html")
    fmt.Fprint(w, "<h2>Index</h2>")
}

func logPanics(function HandleFunc) HandleFunc {
    return func(w http.ResponseWriter, req *http.Request) {
        defer func() {
            if err := recover(); err != nil {
              log.Printf("[%v] caught panic: %v", req.RemoteAddr, err)
            }
        }()
        function(w, req) // Where do w and req come from?
    }
}

```

Later on this is invoked via:

```
http.HandleFunc("/", logPanics(Index))

```

I understand most of it, but wonder how w and req used in 

```
function(w, req)

```

get their values? Do I understand correctly, that the w and req in the return statement

```
return func(w http.ResponseWriter, req *http.Request)

```

are completely different? Then I wonder, how do w and req get their values. I hope somebody can shed some light on my question as I really want to understand what's going on instead of just copying and pasting.