master v1.0.3
李光春 2 years ago
parent 41feacfcd0
commit 307d77115c

3
.gitignore vendored

@ -4,4 +4,5 @@
.idea
.vscode
.log
gomod.sh
gomod.sh
/vendor/

@ -1,3 +1,3 @@
package gotrace_id
const Version = "1.0.2"
const Version = "1.0.3"

@ -19,7 +19,7 @@ func SetGinTraceIdContext(c *gin.Context) context.Context {
// GetTraceIdContext 通过上下文获取跟踪编号
func GetTraceIdContext(ctx context.Context) string {
traceId := fmt.Sprintf("%v", ctx.Value("trace_id"))
traceId := fmt.Sprintf("%s", ctx.Value("trace_id"))
if len(traceId) <= 0 {
return ""
}

@ -21,7 +21,7 @@ func SetGinTraceId() gin.HandlerFunc {
// GetGinTraceId 通过gin中间件获取跟踪编号
func GetGinTraceId(c *gin.Context) string {
traceId := fmt.Sprintf("%v", c.MustGet("trace_id"))
traceId := fmt.Sprintf("%s", c.MustGet("trace_id"))
if len(traceId) <= 0 {
return ""
}

Loading…
Cancel
Save