From 307d77115c9d4d355368b0166aede018ea749c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Sun, 14 Aug 2022 08:48:13 +0800 Subject: [PATCH] - update --- .gitignore | 3 ++- const.go | 2 +- context.go | 2 +- gin_use.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2ee9f26..1d0dadc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .idea .vscode .log -gomod.sh \ No newline at end of file +gomod.sh +/vendor/ diff --git a/const.go b/const.go index dcd4a7a..c32fcf7 100644 --- a/const.go +++ b/const.go @@ -1,3 +1,3 @@ package gotrace_id -const Version = "1.0.2" +const Version = "1.0.3" diff --git a/context.go b/context.go index b088204..1cd970b 100644 --- a/context.go +++ b/context.go @@ -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 "" } diff --git a/gin_use.go b/gin_use.go index 2482981..e79afb4 100644 --- a/gin_use.go +++ b/gin_use.go @@ -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 "" }