MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / Start

Function Start

internal/tracer/trace.go:15–32  ·  view source on GitHub ↗

Start starts Go's runtime tracing facility. Traces will be written to the file named by [debug.Debug.Trace]. It also starts a new [*trace.Task] that will be stopped when the cleanup is called.

(base context.Context)

Source from the content-addressed store, hash-verified

13// Traces will be written to the file named by [debug.Debug.Trace].
14// It also starts a new [*trace.Task] that will be stopped when the cleanup is called.
15func Start(base context.Context) (_ context.Context, cleanup func(), _ error) {
16 f, err := os.Create(debug.Debug.Trace)
17 if err != nil {
18 return base, cleanup, fmt.Errorf("failed to create trace output file: %v", err)
19 }
20
21 if err := trace.Start(f); err != nil {
22 return base, cleanup, fmt.Errorf("failed to start trace: %v", err)
23 }
24
25 ctx, task := trace.NewTask(base, "sqlc")
26
27 return ctx, func() {
28 defer f.Close()
29 defer trace.Stop()
30 defer task.End()
31 }, nil
32}

Callers 1

DoFunction · 0.92

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected