aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-02-02 17:18:05 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:17:20 +0300
commitbf45c42c5fc90bf8d855cdf4e382aa29ba041fdb (patch)
tree11d600b3b587c8734fcf7c6969cb67062df3fbbe /vendor/github.com/golang
parente4284bb3757feda8fac79a07ed9d0a38cb2c28ca (diff)
downloadydb-bf45c42c5fc90bf8d855cdf4e382aa29ba041fdb.tar.gz
Update vendor/go.opentelemetry.io/otel to 1.22.0
Diffstat (limited to 'vendor/github.com/golang')
-rw-r--r--vendor/github.com/golang/glog/glog.go29
-rw-r--r--vendor/github.com/golang/glog/glog_file.go16
-rw-r--r--vendor/github.com/golang/glog/glog_file_linux.go39
-rw-r--r--vendor/github.com/golang/glog/glog_file_posix.go53
-rw-r--r--vendor/github.com/golang/glog/glog_flags.go9
-rw-r--r--vendor/github.com/golang/glog/internal/stackdump/ya.make8
-rw-r--r--vendor/github.com/golang/glog/ya.make18
7 files changed, 133 insertions, 39 deletions
diff --git a/vendor/github.com/golang/glog/glog.go b/vendor/github.com/golang/glog/glog.go
index e108ae8b4f..dd0ed10156 100644
--- a/vendor/github.com/golang/glog/glog.go
+++ b/vendor/github.com/golang/glog/glog.go
@@ -92,7 +92,6 @@ import (
"strconv"
"sync"
"sync/atomic"
- "syscall"
"time"
"github.com/golang/glog/internal/logsink"
@@ -524,34 +523,6 @@ func fatalf(depth int, format string, args ...any) {
os.Exit(2) // Exit with the same code as the default SIGABRT handler.
}
-// abortProcess attempts to kill the current process in a way that will dump the
-// currently-running goroutines someplace useful (Coroner or stderr).
-//
-// It does this by sending SIGABRT to the current process. Unfortunately, the
-// signal may or may not be delivered to the current thread; in order to do that
-// portably, we would need to add a cgo dependency and call pthread_kill.
-//
-// If successful, abortProcess does not return.
-func abortProcess() error {
- p, err := os.FindProcess(os.Getpid())
- if err != nil {
- return err
- }
- if err := p.Signal(syscall.SIGABRT); err != nil {
- return err
- }
-
- // Sent the signal. Now we wait for it to arrive and any SIGABRT handlers to
- // run (and eventually terminate the process themselves).
- //
- // We could just "select{}" here, but there's an outside chance that would
- // trigger the runtime's deadlock detector if there happen not to be any
- // background goroutines running. So we'll sleep a while first to give
- // the signal some time.
- time.Sleep(10 * time.Second)
- select {}
-}
-
// Fatal logs to the FATAL, ERROR, WARNING, and INFO logs,
// including a stack trace of all running goroutines, then calls os.Exit(2).
// Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
diff --git a/vendor/github.com/golang/glog/glog_file.go b/vendor/github.com/golang/glog/glog_file.go
index af1c934b82..e7d125c5ae 100644
--- a/vendor/github.com/golang/glog/glog_file.go
+++ b/vendor/github.com/golang/glog/glog_file.go
@@ -132,6 +132,11 @@ func create(tag string, t time.Time) (f *os.File, filename string, err error) {
symlink := filepath.Join(dir, link)
os.Remove(symlink) // ignore err
os.Symlink(name, symlink) // ignore err
+ if *logLink != "" {
+ lsymlink := filepath.Join(*logLink, link)
+ os.Remove(lsymlink) // ignore err
+ os.Symlink(fname, lsymlink) // ignore err
+ }
return f, fname, nil
}
lastErr = err
@@ -153,8 +158,6 @@ var sinks struct {
}
func init() {
- sinks.stderr.w = os.Stderr
-
// Register stderr first: that way if we crash during file-writing at least
// the log will have gone somewhere.
logsink.TextSinks = append(logsink.TextSinks, &sinks.stderr, &sinks.file)
@@ -167,7 +170,7 @@ func init() {
// if they meet certain conditions.
type stderrSink struct {
mu sync.Mutex
- w io.Writer
+ w io.Writer // if nil Emit uses os.Stderr directly
}
// Enabled implements logsink.Text.Enabled. It returns true if any of the
@@ -182,8 +185,11 @@ func (s *stderrSink) Enabled(m *logsink.Meta) bool {
func (s *stderrSink) Emit(m *logsink.Meta, data []byte) (n int, err error) {
s.mu.Lock()
defer s.mu.Unlock()
-
- dn, err := s.w.Write(data)
+ w := s.w
+ if w == nil {
+ w = os.Stderr
+ }
+ dn, err := w.Write(data)
n += dn
return n, err
}
diff --git a/vendor/github.com/golang/glog/glog_file_linux.go b/vendor/github.com/golang/glog/glog_file_linux.go
new file mode 100644
index 0000000000..d795092d03
--- /dev/null
+++ b/vendor/github.com/golang/glog/glog_file_linux.go
@@ -0,0 +1,39 @@
+// Go support for leveled logs, analogous to https://github.com/google/glog.
+//
+// Copyright 2023 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build linux
+
+package glog
+
+import (
+ "errors"
+ "runtime"
+ "syscall"
+)
+
+// abortProcess attempts to kill the current process in a way that will dump the
+// currently-running goroutines someplace useful (like stderr).
+//
+// It does this by sending SIGABRT to the current thread.
+//
+// If successful, abortProcess does not return.
+func abortProcess() error {
+ runtime.LockOSThread()
+ if err := syscall.Tgkill(syscall.Getpid(), syscall.Gettid(), syscall.SIGABRT); err != nil {
+ return err
+ }
+ return errors.New("log: killed current thread with SIGABRT, but still running")
+}
diff --git a/vendor/github.com/golang/glog/glog_file_posix.go b/vendor/github.com/golang/glog/glog_file_posix.go
new file mode 100644
index 0000000000..c27c7c0e4a
--- /dev/null
+++ b/vendor/github.com/golang/glog/glog_file_posix.go
@@ -0,0 +1,53 @@
+// Go support for leveled logs, analogous to https://github.com/google/glog.
+//
+// Copyright 2023 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build (unix || windows) && !linux
+
+package glog
+
+import (
+ "os"
+ "syscall"
+ "time"
+)
+
+// abortProcess attempts to kill the current process in a way that will dump the
+// currently-running goroutines someplace useful (like stderr).
+//
+// It does this by sending SIGABRT to the current process. Unfortunately, the
+// signal may or may not be delivered to the current thread; in order to do that
+// portably, we would need to add a cgo dependency and call pthread_kill.
+//
+// If successful, abortProcess does not return.
+func abortProcess() error {
+ p, err := os.FindProcess(os.Getpid())
+ if err != nil {
+ return err
+ }
+ if err := p.Signal(syscall.SIGABRT); err != nil {
+ return err
+ }
+
+ // Sent the signal. Now we wait for it to arrive and any SIGABRT handlers to
+ // run (and eventually terminate the process themselves).
+ //
+ // We could just "select{}" here, but there's an outside chance that would
+ // trigger the runtime's deadlock detector if there happen not to be any
+ // background goroutines running. So we'll sleep a while first to give
+ // the signal some time.
+ time.Sleep(10 * time.Second)
+ select {}
+}
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:]
diff --git a/vendor/github.com/golang/glog/internal/stackdump/ya.make b/vendor/github.com/golang/glog/internal/stackdump/ya.make
index 418a48d05e..fcf5196b50 100644
--- a/vendor/github.com/golang/glog/internal/stackdump/ya.make
+++ b/vendor/github.com/golang/glog/internal/stackdump/ya.make
@@ -2,10 +2,14 @@ GO_LIBRARY()
LICENSE(Apache-2.0)
-SRCS(stackdump.go)
+SRCS(
+ stackdump.go
+)
GO_XTEST_SRCS(stackdump_test.go)
END()
-RECURSE(gotest)
+RECURSE(
+ gotest
+)
diff --git a/vendor/github.com/golang/glog/ya.make b/vendor/github.com/golang/glog/ya.make
index 7ec4abff03..11a6503d84 100644
--- a/vendor/github.com/golang/glog/ya.make
+++ b/vendor/github.com/golang/glog/ya.make
@@ -14,6 +14,24 @@ GO_TEST_SRCS(
glog_vmodule_test.go
)
+IF (OS_LINUX)
+ SRCS(
+ glog_file_linux.go
+ )
+ENDIF()
+
+IF (OS_DARWIN)
+ SRCS(
+ glog_file_posix.go
+ )
+ENDIF()
+
+IF (OS_WINDOWS)
+ SRCS(
+ glog_file_posix.go
+ )
+ENDIF()
+
END()
RECURSE(