fortio.org/log@v1.12.2/goroutine/README.md (about)

     1  If you just want a thread ID / goroutine ID use the original this was imported from:
     2  
     3  https://github.com/kortschak/goroutine/
     4  
     5  Credits goes to Dan Kortschak and Laevus Dexter
     6  
     7  # goroutine identification
     8  
     9  Package goroutine provides a single function that will return the runtime's
    10  ID number for the calling goroutine.
    11  
    12  The implementation is derived from Laevus Dexter's comment in Gophers' Slack
    13  #darkarts, https://gophers.slack.com/archives/C1C1YSQBT/p1593885226448300
    14  post which linked to this playground snippet https://play.golang.org/p/CSOp9wyzydP.
    15  
    16  The code here is an exercise in minimalism, doing as little as possible by
    17  deferring nearly all of the logic to runtime functions co-opted via
    18  `//go:linkname` comments.