0

Here are the first lines of the file sleep.go in the time package of the Go core library:

// 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)

// runtimeNano returns the current value of the runtime clock in nanoseconds.
func runtimeNano() int64

Why is there no declaration of the function time.Sleep here? Where is it?

Pierre Prinetti
  • 9,092
  • 6
  • 33
  • 49
  • I've found this: [What does a function without body mean?](https://stackoverflow.com/questions/14938960/what-does-a-function-without-body-mean), which might help you... – tgogos Dec 20 '17 at 17:16

1 Answers1

4

It's in runtime/time.go.

See the compiler directives for details on go:linkname.

Marc
  • 19,394
  • 6
  • 47
  • 51