func main() { router := httprouter.New() router.GET("/user/:username", getUser) log.Fatal(http.ListenAndServe(":8080", router)) } func getUser(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { username := ps.ByName("username") fmt.Fprintf(w, "Hello, %s!", username) }In the above example, the URL pattern `/user/:username` is defined in the router configuration, where `:username` is a dynamic segment that will be captured by Params. In the `getUser` function, `ps.ByName("username")` retrieves the captured segment and uses it as the input parameter to generate the response.