diff --git a/pkg/i18n/helper.go b/pkg/i18n/helper.go index 55a195bd132..233101abc8e 100644 --- a/pkg/i18n/helper.go +++ b/pkg/i18n/helper.go @@ -17,6 +17,7 @@ package i18n import ( "context" "net/http" + "runtime" "github.com/erda-project/erda/pkg/goroutine_context" ) @@ -41,6 +42,11 @@ func GetLocaleNameByRequest(request *http.Request) string { } func GetGoroutineBindLang() string { + // mac system use goroutine_context.GetContext() will panic + if runtime.GOOS == "darwin" { + return "" + } + globalContext := goroutine_context.GetContext() if globalContext == nil { return "" @@ -58,6 +64,11 @@ func GetGoroutineBindLang() string { } func SetGoroutineBindLang(localeName string) { + // mac system use goroutine_context.GetContext() will panic + if runtime.GOOS == "darwin" { + return + } + ctx := goroutine_context.GetContext() if ctx == nil { ctx = context.Background()