is the same, you put the mux.Vars into your mothods/functions
package main
import (
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
)
func YourHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
fmt.Println(id)
w.Write([]byte("Gorilla!\n"))
}
func main() {
r := mux.NewRouter()
// Routes consist of a path and a handler function.
r.HandleFunc("/product/{id:[0-9]+}", YourHandler)
// Bind to a port and pass our router in
log.Fatal(http.ListenAndServe(":8000", r))
}
try this example, is the same above
https://github.com/gorilla/mux#full-example