diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-02-02 17:18:05 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-02-09 19:17:20 +0300 |
commit | bf45c42c5fc90bf8d855cdf4e382aa29ba041fdb (patch) | |
tree | 11d600b3b587c8734fcf7c6969cb67062df3fbbe /vendor/github.com/golang/glog/glog_flags.go | |
parent | e4284bb3757feda8fac79a07ed9d0a38cb2c28ca (diff) | |
download | ydb-bf45c42c5fc90bf8d855cdf4e382aa29ba041fdb.tar.gz |
Update vendor/go.opentelemetry.io/otel to 1.22.0
Diffstat (limited to 'vendor/github.com/golang/glog/glog_flags.go')
-rw-r--r-- | vendor/github.com/golang/glog/glog_flags.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vendor/github.com/golang/glog/glog_flags.go b/vendor/github.com/golang/glog/glog_flags.go index 3060e54d9d..fa4371afd3 100644 --- a/vendor/github.com/golang/glog/glog_flags.go +++ b/vendor/github.com/golang/glog/glog_flags.go @@ -133,6 +133,11 @@ func (l *Level) Set(value string) error { type vModuleFlag struct{ *verboseFlags } func (f vModuleFlag) String() string { + // Do not panic on the zero value. + // https://groups.google.com/g/golang-nuts/c/Atlr8uAjn6U/m/iId17Td5BQAJ. + if f.verboseFlags == nil { + return "" + } f.mu.Lock() defer f.mu.Unlock() @@ -192,9 +197,7 @@ func (f *verboseFlags) levelForPC(pc uintptr) Level { file, _ := fn.FileLine(pc) // The file is something like /a/b/c/d.go. We want just the d for // regular matches, /a/b/c/d for full matches. - if strings.HasSuffix(file, ".go") { - file = file[:len(file)-3] - } + file = strings.TrimSuffix(file, ".go") full := file if slash := strings.LastIndex(file, "/"); slash >= 0 { file = file[slash+1:] |