huandu / go-tls

A bit safer approach to implement Thread Local Storage (TLS) for Go 1.7+.
MIT License
162 stars 15 forks source link

full link ID based on TLS ? #4

Closed antsbean closed 5 years ago

antsbean commented 5 years ago

In order to achieve full link ID tracking, based on TLS in go, in order to avoid function calls need to pass the context param .In the same coroutine, it is OK to get the link ID according to the coroutine ID, but how can one coroutine start another coroutine without obvious the passing link ID?

huandu commented 5 years ago

I guess you are asking for a feature like "goroutine ID inherence", which requires a child goroutine knows the information of its parent. It's not possible to implement it right now from my understanding.

It's recommended to use Context explicitly instead of using such hack way to implement full link ID tracking. The hack way is so fragile.