Skip to content

Commit

Permalink
vet: log/logger.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Jan 23, 2025
1 parent cbc4a85 commit 2942835
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions intra/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"fmt"
golog "log"
"os"
"reflect"
"runtime"
"strings"
"sync"
Expand Down Expand Up @@ -412,26 +411,3 @@ func (l *simpleLogger) err(at int, msg string) {
_ = l.e.Output(at, msg) // may error
l.q.Push(msg)
}

// from: core/closer.go

func isNotNil(x any) bool {
return !isNil(x)
}

// isNil reports whether x is nil if its Chan, Func, Map,
// Pointer, UnsafePointer, Interface, and Slice;
// may panic if x is not addressable
func isNil(x any) bool {
// from: stackoverflow.com/a/76595928
if x == nil {
return true
}
v := reflect.ValueOf(x)
k := v.Kind()
switch k {
case reflect.Pointer, reflect.UnsafePointer, reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice:
return v.IsNil()
}
return false
}

0 comments on commit 2942835

Please sign in to comment.