package route import ( "git.hilo.cn/hilo-common/mycontext" "github.com/gin-gonic/gin" uuid "github.com/satori/go.uuid" "strings" ) func genTraceId(c *gin.Context) string { if trace := c.GetHeader(mycontext.TRACEID); len(trace) > 0 { return trace } traceId := strings.Replace(uuid.NewV4().String(), "-", "", -1) traceId = traceId[:len(traceId)/2] return traceId }