Skip to content

Commit

Permalink
clean up unused utils
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe committed Sep 21, 2024
1 parent 0aee0ca commit e467087
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 172 deletions.
2 changes: 0 additions & 2 deletions livekit/types_test

This file was deleted.

2 changes: 1 addition & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (l *zapLogger[T]) WithoutSampler() Logger {
func (l *zapLogger[T]) WithDeferredValues() (Logger, DeferredFieldResolver) {
dup := *l
def, resolve := zaputil.NewDeferrer()
dup.deferred = append(dup.deferred[0:len(dup.deferred):len(dup.deferred)], def)
dup.deferred = append(dup.deferred, def)
dup.zap = dup.ToZap()
return &dup, resolve
}
Expand Down
4 changes: 2 additions & 2 deletions logger/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func ToSlogHandler(log Logger) slog.Handler {

type slogDiscard struct{}

func (_ slogDiscard) Enabled(ctx context.Context, level slog.Level) bool {
func (slogDiscard) Enabled(ctx context.Context, level slog.Level) bool {
return false
}

func (_ slogDiscard) Handle(ctx context.Context, record slog.Record) error {
func (slogDiscard) Handle(ctx context.Context, record slog.Record) error {
return nil
}

Expand Down
144 changes: 0 additions & 144 deletions utils/messaging.go

This file was deleted.

22 changes: 0 additions & 22 deletions utils/must.go

This file was deleted.

10 changes: 10 additions & 0 deletions utils/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ func Apply[T any, F ~func(T)](o T, opts []F) T {
}
return o
}

func Make[T any, F ~func(*T)](opts []F) T {
var o T
Apply(&o, opts)
return o
}

func New[T any, F ~func(*T)](opts []F) *T {
return Apply(new(T), opts)
}
2 changes: 1 addition & 1 deletion utils/protoproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (p *ProtoProxy[T]) Updated() <-chan struct{} {
func (p *ProtoProxy[T]) Get() T {
p.lock.RLock()
defer p.lock.RUnlock()
return proto.Clone(p.message).(T)
return CloneProto(p.message)
}

func (p *ProtoProxy[T]) Stop() {
Expand Down

0 comments on commit e467087

Please sign in to comment.