Standard library / runtime/trace

trace.Stop()

Stop tracing and wait for all trace writes. Keep the writer valid until Stop returns. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Stop()

Working Example

Example Snippetgo
package main
import (  "bytes"  "context"  "fmt"  "runtime/trace")
func main() {  var b bytes.Buffer  if err := trace.Start(&b); err != nil {    panic(err)  }  trace.Log(context.Background(), "phase", "demo")  trace.Stop()  fmt.Println(b.Len() > 0)}
Go Reference