mirror of
https://github.com/eiblog/eiblog.git
synced 2026-03-01 00:34:58 +08:00
add vendor
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
package expvar
|
||||
|
||||
import (
|
||||
"expvar"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Handler() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
w := c.Writer
|
||||
c.Header("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write([]byte("{\n"))
|
||||
first := true
|
||||
expvar.Do(func(kv expvar.KeyValue) {
|
||||
if !first {
|
||||
w.Write([]byte(",\n"))
|
||||
}
|
||||
first = false
|
||||
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
|
||||
})
|
||||
w.Write([]byte("\n}\n"))
|
||||
c.AbortWithStatus(200)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user