Update dependencies

This commit is contained in:
eleksir
2025-10-12 15:27:41 +03:00
parent 1330c512aa
commit 5ebefcddf4
491 changed files with 27549 additions and 41202 deletions

View File

@@ -87,7 +87,7 @@ older version of the package.
| detail, eg `WithDetail()` | not visible | visible | no | type only |
| assertion failure annotation, eg `WithAssertionFailure()` | not visible | visible | no | type only |
| issue links, eg `WithIssueLink()`, `UnimplementedError()` | not visible | visible | yes | full |
| safe details, eg `WithSafeDetails()` | not visible | not visible | yes | full |
| safe details, eg `WithSafeDetails()` | not visible | visible | yes | full |
| telemetry keys, eg. `WithTelemetryKey()` | not visible | visible | yes | full |
| secondary errors, eg. `WithSecondaryError()`, `CombineErrors()` | not visible | visible | redacted, recursively | redacted, recursively |
| barrier origins, eg. `Handled()` | not visible | visible | redacted, recursively | redacted, recursively |

View File

@@ -1,3 +0,0 @@
DEPRECATED
Moved to [github.com/cockroachdb/crlib](https://github.com/cockroachdb/crlib/tree/main/fifo)

View File

@@ -26,47 +26,13 @@ type Buffer struct {
}
// SingleTagBuffer returns a Buffer with a single tag.
func SingleTagBuffer(key string, value any) *Buffer {
func SingleTagBuffer(key string, value interface{}) *Buffer {
b := &Buffer{}
b.init(1, 1)
b.tags[0] = Tag{key: key, value: value}
return b
}
// BuildBuffer is used to build a *Buffer that contains an arbitrary number
// of tags. Sample usage:
//
// bld := BuildBuffer()
// bld.Add("a", 1)
// bld.Add("b", 2)
// buf := bld.Finish()
//
// It is equivalent to using SingleTagBuffer() followed by Buffer.Add() calls,
// but avoids allocating each intermediate buffer.
func BuildBuffer() BufferBuilder {
bld := BufferBuilder{b: &Buffer{}}
bld.b.init(0, 0)
return bld
}
// BufferBuilder is returned by BuildBuffer.
type BufferBuilder struct {
b *Buffer
}
// Add a log tag to the buffer. If the key was added already, the value is
// replaced.
func (bld *BufferBuilder) Add(key string, value any) {
bld.b.addOrReplace(key, value)
}
// Finish returns the buffer with the tags that were added to the builder.
func (bld *BufferBuilder) Finish() *Buffer {
b := bld.b
bld.b = nil
return b
}
// Get returns the tags, as a slice. This slice must not be modified.
func (b *Buffer) Get() []Tag {
return b.tags
@@ -89,7 +55,7 @@ func (b *Buffer) GetTag(key string) (Tag, bool) {
// Add returns a new buffer with one more tag. If the tag has the same key as an
// earlier tag, that tag is overwritten.
// The receiver can be nil.
func (b *Buffer) Add(key string, value any) *Buffer {
func (b *Buffer) Add(key string, value interface{}) *Buffer {
if b == nil {
return SingleTagBuffer(key, value)
}
@@ -225,7 +191,7 @@ func (b *Buffer) init(length, capacityHint int) {
}
}
func (b *Buffer) addOrReplace(key string, value any) {
func (b *Buffer) addOrReplace(key string, value interface{}) {
for i := range b.tags {
if b.tags[i].key == key {
b.tags[i].value = value

View File

@@ -21,9 +21,6 @@ type contextLogTagsKey struct{}
// FromContext returns the tags stored in the context (by WithTags, AddTag, or
// AddTags).
func FromContext(ctx context.Context) *Buffer {
if fromContextFn != nil {
return fromContextFn(ctx)
}
val := ctx.Value(contextLogTagsKey{})
if val == nil {
return nil
@@ -34,9 +31,6 @@ func FromContext(ctx context.Context) *Buffer {
// WithTags returns a context with the given tags. Any existing tags are
// ignored.
func WithTags(ctx context.Context, tags *Buffer) context.Context {
if withTagsFn != nil {
return withTagsFn(ctx, tags)
}
return context.WithValue(ctx, contextLogTagsKey{}, tags)
}
@@ -69,19 +63,3 @@ func AddTags(ctx context.Context, tags *Buffer) context.Context {
}
return WithTags(ctx, newB)
}
// OverrideContextFuncs can be used to override the implementation of
// FromContext and WithTags. This is useful if we have a more efficient
// implementation of context-associated values.
//
// Must be called before WithTags or FromContext are called.
func OverrideContextFuncs(
fromContext func(ctx context.Context) *Buffer,
withTags func(ctx context.Context, tags *Buffer) context.Context,
) {
fromContextFn = fromContext
withTagsFn = withTags
}
var fromContextFn func(ctx context.Context) *Buffer
var withTagsFn func(ctx context.Context, tags *Buffer) context.Context

View File

@@ -130,16 +130,6 @@ func (b *StringBuilder) SafeRune(s i.SafeRune) {
_ = b.Buffer.WriteRune(rune(s))
}
func (b *StringBuilder) SafeByte(s i.SafeByte) {
b.SetMode(ib.SafeEscaped)
_ = b.Buffer.WriteByte(byte(s))
}
func (b *StringBuilder) SafeBytes(s i.SafeBytes) {
b.SetMode(ib.SafeEscaped)
_, _ = b.Buffer.Write([]byte(s))
}
// UnsafeString is part of the SafeWriter interface.
func (b *StringBuilder) UnsafeString(s string) {
b.SetMode(ib.UnsafeEscaped)

View File

@@ -65,12 +65,6 @@ type SafeWriter interface {
// SafeRune emits a safe rune.
SafeRune(SafeRune)
// SafeByte emits a safe byte.
SafeByte(SafeByte)
// SafeBytes emits a safe byte slice.
SafeBytes(SafeBytes)
// Print emits its arguments separated by spaces.
// For each argument it dynamically checks for the SafeFormatter or
// SafeValue interface and either use that, or mark the argument
@@ -125,18 +119,6 @@ type SafeRune rune
// SafeValue makes SafeRune a SafeValue.
func (SafeRune) SafeValue() {}
// SafeByte represents a byte that is not a sensitive value.
type SafeByte byte
// SafeValue makes SafeByte a SafeValue.
func (SafeByte) SafeValue() {}
// SafeBytes represents a byte slice that is not a sensitive value.
type SafeBytes []byte
// SafeValue makes SafeBytes a SafeValue.
func (SafeBytes) SafeValue() {}
// SafeValue is a marker interface to be implemented by types that
// alias base Go types and whose natural representation via Printf is
// always safe for reporting.

View File

@@ -46,18 +46,6 @@ func (p *pp) SafeRune(r i.SafeRune) {
p.buf.WriteRune(rune(r))
}
// SafeByte implements SafePrinter.
func (p *pp) SafeByte(r i.SafeByte) {
defer p.startSafeOverride().restore()
p.buf.WriteByte(byte(r))
}
// SafeBytes implements SafePrinter.
func (p *pp) SafeBytes(r i.SafeBytes) {
defer p.startSafeOverride().restore()
p.buf.Write(r)
}
func (p *pp) Print(args ...interface{}) {
defer p.buf.SetMode(p.buf.GetMode())
np := newPrinter()