Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  The magic of go:linkname

When writing Go program, there is frequent need on using time.Sleep() function to pause the logic for some time. And if jumping to the definition of this function, can see below definition:// Sleep pauses the current goroutine for at least the duration d.// A negative or zero duration causes Sleep to return immediately.func Sleep(d Duration)I's strange that there is no function body defined here. What happened? The actual definition of the function body is residing at runtime/time.go indeed.// timeSleep puts the current goroutine to sleep for at least ns nanoseconds.//go:linkname tim...

12,122 0       TRICKS GOLANG GO:LINKNAME