A expvar handler for gin framework, expvar provides a standardized interface to public variables.
Download and install it:
go get github.com/gin-contrib/expvar
Import it in your code:
import "github.com/gin-contrib/expvar"
package main
import (
"log"
"github.com/gin-contrib/expvar"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.GET("/debug/vars", expvar.Handler())
if err := r.Run(":8080"); err != nil {
log.Fatal(err)
}
}