File: trace_notrace.go

package info (click to toggle)
golang-github-grpc-ecosystem-go-grpc-middleware 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,564 kB
  • sloc: makefile: 100; sh: 9
file content (29 lines) | stat: -rw-r--r-- 880 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) The go-grpc-middleware Authors.
// Licensed under the Apache License 2.0.

//go:build retrynotrace

package retry

// retrynotrace can be used to avoid importing golang.org/x/net/trace,
// which allows for more aggressive deadcode elimination, which can
// yield improvements in binary size when tracing is not needed.

import (
	"context"
	"fmt"
)

type notrace struct{}

func (notrace) LazyLog(x fmt.Stringer, sensitive bool) {}
func (notrace) LazyPrintf(format string, a ...any)     {}
func (notrace) SetError()                              {}
func (notrace) SetRecycler(f func(any))                {}
func (notrace) SetTraceInfo(traceID, spanID uint64)    {}
func (notrace) SetMaxEvents(m int)                     {}
func (notrace) Finish()                                {}

func traceFromCtx(ctx context.Context) (notrace, bool) {
	return notrace{}, true
}