1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 06:29:29 +01:00

chore(deps): bump github.com/golang/glog from 1.2.2 to 1.2.4

Bumps [github.com/golang/glog](https://github.com/golang/glog) from 1.2.2 to 1.2.4.
- [Release notes](https://github.com/golang/glog/releases)
- [Commits](https://github.com/golang/glog/compare/v1.2.2...v1.2.4)

---
updated-dependencies:
- dependency-name: github.com/golang/glog
  dependency-version: 1.2.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2025-05-02 02:23:03 +00:00
committed by GitHub
parent ee376e12ac
commit a3ca3093e5
8 changed files with 114 additions and 63 deletions

2
go.mod
View File

@@ -62,7 +62,7 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.2 // indirect github.com/golang/glog v1.2.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect github.com/golang/protobuf v1.5.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20210514010506-3b9f47219fe7 // indirect github.com/gomarkdown/markdown v0.0.0-20210514010506-3b9f47219fe7 // indirect
github.com/google/btree v1.1.3 // indirect github.com/google/btree v1.1.3 // indirect

4
go.sum
View File

@@ -111,8 +111,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc=
github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=

View File

@@ -1,41 +1,41 @@
# logfmt # logfmt
[![Go Reference](https://pkg.go.dev/badge/github.com/go-logfmt/logfmt.svg)](https://pkg.go.dev/github.com/go-logfmt/logfmt) [![Go Reference](https://pkg.go.dev/badge/github.com/go-logfmt/logfmt.svg)](https://pkg.go.dev/github.com/go-logfmt/logfmt)
[![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt) [![Go Report Card](https://goreportcard.com/badge/go-logfmt/logfmt)](https://goreportcard.com/report/go-logfmt/logfmt)
[![Github Actions](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml/badge.svg)](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml) [![Github Actions](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml/badge.svg)](https://github.com/go-logfmt/logfmt/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=main) [![Coverage Status](https://coveralls.io/repos/github/go-logfmt/logfmt/badge.svg?branch=master)](https://coveralls.io/github/go-logfmt/logfmt?branch=main)
Package logfmt implements utilities to marshal and unmarshal data in the [logfmt Package logfmt implements utilities to marshal and unmarshal data in the [logfmt
format][fmt]. It provides an API similar to [encoding/json][json] and format][fmt]. It provides an API similar to [encoding/json][json] and
[encoding/xml][xml]. [encoding/xml][xml].
[fmt]: https://brandur.org/logfmt [fmt]: https://brandur.org/logfmt
[json]: https://pkg.go.dev/encoding/json [json]: https://pkg.go.dev/encoding/json
[xml]: https://pkg.go.dev/encoding/xml [xml]: https://pkg.go.dev/encoding/xml
The logfmt format was first documented by Brandur Leach in [this The logfmt format was first documented by Brandur Leach in [this
article][origin]. The format has not been formally standardized. The most article][origin]. The format has not been formally standardized. The most
authoritative public specification to date has been the documentation of a Go authoritative public specification to date has been the documentation of a Go
Language [package][parser] written by Blake Mizerany and Keith Rarick. Language [package][parser] written by Blake Mizerany and Keith Rarick.
[origin]: https://brandur.org/logfmt [origin]: https://brandur.org/logfmt
[parser]: https://pkg.go.dev/github.com/kr/logfmt [parser]: https://pkg.go.dev/github.com/kr/logfmt
## Goals ## Goals
This project attempts to conform as closely as possible to the prior art, while This project attempts to conform as closely as possible to the prior art, while
also removing ambiguity where necessary to provide well behaved encoder and also removing ambiguity where necessary to provide well behaved encoder and
decoder implementations. decoder implementations.
## Non-goals ## Non-goals
This project does not attempt to formally standardize the logfmt format. In the This project does not attempt to formally standardize the logfmt format. In the
event that logfmt is standardized this project would take conforming to the event that logfmt is standardized this project would take conforming to the
standard as a goal. standard as a goal.
## Versioning ## Versioning
This project publishes releases according to the Go language guidelines for This project publishes releases according to the Go language guidelines for
[developing and publishing modules][pub]. [developing and publishing modules][pub].
[pub]: https://go.dev/doc/modules/developing [pub]: https://go.dev/doc/modules/developing

View File

@@ -76,7 +76,7 @@
// -log_backtrace_at=gopherflakes.go:234 // -log_backtrace_at=gopherflakes.go:234
// A stack trace will be written to the Info log whenever execution // A stack trace will be written to the Info log whenever execution
// hits one of these statements. (Unlike with -vmodule, the ".go" // hits one of these statements. (Unlike with -vmodule, the ".go"
// must bepresent.) // must be present.)
// -v=0 // -v=0
// Enable V-leveled logging at the specified level. // Enable V-leveled logging at the specified level.
// -vmodule="" // -vmodule=""

View File

@@ -116,32 +116,53 @@ var onceLogDirs sync.Once
// contains tag ("INFO", "FATAL", etc.) and t. If the file is created // contains tag ("INFO", "FATAL", etc.) and t. If the file is created
// successfully, create also attempts to update the symlink for that tag, ignoring // successfully, create also attempts to update the symlink for that tag, ignoring
// errors. // errors.
func create(tag string, t time.Time) (f *os.File, filename string, err error) { func create(tag string, t time.Time, dir string) (f *os.File, filename string, err error) {
if dir != "" {
f, name, err := createInDir(dir, tag, t)
if err == nil {
return f, name, err
}
return nil, "", fmt.Errorf("log: cannot create log: %v", err)
}
onceLogDirs.Do(createLogDirs) onceLogDirs.Do(createLogDirs)
if len(logDirs) == 0 { if len(logDirs) == 0 {
return nil, "", errors.New("log: no log dirs") return nil, "", errors.New("log: no log dirs")
} }
name, link := logName(tag, t)
var lastErr error var lastErr error
for _, dir := range logDirs { for _, dir := range logDirs {
fname := filepath.Join(dir, name) f, name, err := createInDir(dir, tag, t)
f, err := os.Create(fname)
if err == nil { if err == nil {
symlink := filepath.Join(dir, link) return f, name, err
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 lastErr = err
} }
return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr) return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
} }
func createInDir(dir, tag string, t time.Time) (f *os.File, name string, err error) {
name, link := logName(tag, t)
fname := filepath.Join(dir, name)
// O_EXCL is important here, as it prevents a vulnerability. The general idea is that logs often
// live in an insecure directory (like /tmp), so an unprivileged attacker could create fname in
// advance as a symlink to a file the logging process can access, but the attacker cannot. O_EXCL
// fails the open if it already exists, thus prevent our this code from opening the existing file
// the attacker points us to.
f, err = os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666)
if err == nil {
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
}
return nil, "", err
}
// flushSyncWriter is the interface satisfied by logging destinations. // flushSyncWriter is the interface satisfied by logging destinations.
type flushSyncWriter interface { type flushSyncWriter interface {
Flush() error Flush() error
@@ -158,7 +179,10 @@ var sinks struct {
func init() { func init() {
// Register stderr first: that way if we crash during file-writing at least // Register stderr first: that way if we crash during file-writing at least
// the log will have gone somewhere. // the log will have gone somewhere.
logsink.TextSinks = append(logsink.TextSinks, &sinks.stderr, &sinks.file) if shouldRegisterStderrSink() {
logsink.TextSinks = append(logsink.TextSinks, &sinks.stderr)
}
logsink.TextSinks = append(logsink.TextSinks, &sinks.file)
sinks.file.flushChan = make(chan logsink.Severity, 1) sinks.file.flushChan = make(chan logsink.Severity, 1)
go sinks.file.flushDaemon() go sinks.file.flushDaemon()
@@ -245,6 +269,7 @@ type syncBuffer struct {
names []string names []string
sev logsink.Severity sev logsink.Severity
nbytes uint64 // The number of bytes written to this file nbytes uint64 // The number of bytes written to this file
madeAt time.Time
} }
func (sb *syncBuffer) Sync() error { func (sb *syncBuffer) Sync() error {
@@ -252,9 +277,14 @@ func (sb *syncBuffer) Sync() error {
} }
func (sb *syncBuffer) Write(p []byte) (n int, err error) { func (sb *syncBuffer) Write(p []byte) (n int, err error) {
// Rotate the file if it is too large, but ensure we only do so,
// if rotate doesn't create a conflicting filename.
if sb.nbytes+uint64(len(p)) >= MaxSize { if sb.nbytes+uint64(len(p)) >= MaxSize {
if err := sb.rotateFile(time.Now()); err != nil { now := timeNow()
return 0, err if now.After(sb.madeAt.Add(1*time.Second)) || now.Second() != sb.madeAt.Second() {
if err := sb.rotateFile(now); err != nil {
return 0, err
}
} }
} }
n, err = sb.Writer.Write(p) n, err = sb.Writer.Write(p)
@@ -272,7 +302,8 @@ const footer = "\nCONTINUED IN NEXT FILE\n"
func (sb *syncBuffer) rotateFile(now time.Time) error { func (sb *syncBuffer) rotateFile(now time.Time) error {
var err error var err error
pn := "<none>" pn := "<none>"
file, name, err := create(sb.sev.String(), now) file, name, err := create(sb.sev.String(), now, "")
sb.madeAt = now
if sb.file != nil { if sb.file != nil {
// The current log file becomes the previous log at the end of // The current log file becomes the previous log at the end of

View File

@@ -4,6 +4,13 @@ package glog
import "os/user" import "os/user"
// shouldRegisterStderrSink determines whether we should register a log sink that writes to stderr.
// Today, this always returns true on non-Windows platforms, as it specifically checks for a
// condition that is only present on Windows.
func shouldRegisterStderrSink() bool {
return true
}
func lookupUser() string { func lookupUser() string {
if current, err := user.Current(); err == nil { if current, err := user.Current(); err == nil {
return current.Username return current.Username

View File

@@ -3,9 +3,22 @@
package glog package glog
import ( import (
"os"
"syscall" "syscall"
) )
// shouldRegisterStderrSink determines whether we should register a log sink that writes to stderr.
// Today, this checks if stderr is "valid", in that it maps to a non-NULL Handle.
// Windows Services are spawned without Stdout and Stderr, so any attempt to use them equates to
// referencing an invalid file Handle.
// os.Stderr's FD is derived from a call to `syscall.GetStdHandle(syscall.STD_ERROR_HANDLE)`.
// Documentation[1] for the GetStdHandle function indicates the return value may be NULL if the
// application lacks the standard handle, so consider Stderr valid if its FD is non-NULL.
// [1]: https://learn.microsoft.com/en-us/windows/console/getstdhandle
func shouldRegisterStderrSink() bool {
return os.Stderr.Fd() != 0
}
// This follows the logic in the standard library's user.Current() function, except // This follows the logic in the standard library's user.Current() function, except
// that it leaves out the potentially expensive calls required to look up the user's // that it leaves out the potentially expensive calls required to look up the user's
// display name in Active Directory. // display name in Active Directory.

2
vendor/modules.txt vendored
View File

@@ -91,7 +91,7 @@ github.com/gogo/protobuf/gogoproto
github.com/gogo/protobuf/proto github.com/gogo/protobuf/proto
github.com/gogo/protobuf/protoc-gen-gogo/descriptor github.com/gogo/protobuf/protoc-gen-gogo/descriptor
github.com/gogo/protobuf/sortkeys github.com/gogo/protobuf/sortkeys
# github.com/golang/glog v1.2.2 # github.com/golang/glog v1.2.4
## explicit; go 1.19 ## explicit; go 1.19
github.com/golang/glog github.com/golang/glog
github.com/golang/glog/internal/logsink github.com/golang/glog/internal/logsink