Run modernize (#21546)

`go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...` executed.

`go generate ./...` ran afterwards to keep generated.
This commit is contained in:
Klaus Post
2025-08-29 04:39:48 +02:00
committed by GitHub
parent 3b7cb6512c
commit f0b91e5504
238 changed files with 913 additions and 1257 deletions

View File

@@ -61,7 +61,7 @@ const (
)
var (
logChBuffers = make(map[string]chan interface{})
logChBuffers = make(map[string]chan any)
logChLock = sync.Mutex{}
)
@@ -84,7 +84,7 @@ type Config struct {
HTTPTimeout time.Duration `json:"httpTimeout"`
// Custom logger
LogOnceIf func(ctx context.Context, err error, id string, errKind ...interface{}) `json:"-"`
LogOnceIf func(ctx context.Context, err error, id string, errKind ...any) `json:"-"`
}
// Target implements logger.Target and sends the json
@@ -109,7 +109,7 @@ type Target struct {
// Channel of log entries.
// Reading logCh must hold read lock on logChMu (to avoid read race)
// Sending a value on logCh must hold read lock on logChMu (to avoid closing)
logCh chan interface{}
logCh chan any
logChMu sync.RWMutex
// If this webhook is being re-configured we will
@@ -131,7 +131,7 @@ type Target struct {
// store to persist and replay the logs to the target
// to avoid missing events when the target is down.
store store.Store[interface{}]
store store.Store[any]
storeCtxCancel context.CancelFunc
initQueueOnce once.Init
@@ -199,7 +199,7 @@ func (h *Target) initDiskStore(ctx context.Context) (err error) {
h.lastStarted = time.Now()
go h.startQueueProcessor(ctx, true)
queueStore := store.NewQueueStore[interface{}](
queueStore := store.NewQueueStore[any](
filepath.Join(h.config.QueueDir, h.Name()),
uint64(h.config.QueueSize),
httpLoggerExtension,
@@ -289,7 +289,7 @@ func (h *Target) startQueueProcessor(ctx context.Context, mainWorker bool) {
h.wg.Add(1)
defer h.wg.Done()
entries := make([]interface{}, 0)
entries := make([]any, 0)
name := h.Name()
defer func() {
@@ -455,7 +455,7 @@ func (h *Target) startQueueProcessor(ctx context.Context, mainWorker bool) {
}
}
entries = make([]interface{}, 0)
entries = make([]any, 0)
count = 0
if !isDirQueue {
buf.Reset()
@@ -481,7 +481,7 @@ func CreateOrAdjustGlobalBuffer(currentTgt *Target, newTgt *Target) {
currentBuff, ok := logChBuffers[name]
if !ok {
logChBuffers[name] = make(chan interface{}, requiredCap)
logChBuffers[name] = make(chan any, requiredCap)
currentCap = requiredCap
} else {
currentCap = cap(currentBuff)
@@ -489,7 +489,7 @@ func CreateOrAdjustGlobalBuffer(currentTgt *Target, newTgt *Target) {
}
if requiredCap > currentCap {
logChBuffers[name] = make(chan interface{}, requiredCap)
logChBuffers[name] = make(chan any, requiredCap)
if len(currentBuff) > 0 {
drain:
@@ -519,7 +519,7 @@ func New(config Config) (*Target, error) {
}
h := &Target{
logCh: make(chan interface{}, config.QueueSize),
logCh: make(chan any, config.QueueSize),
config: config,
batchSize: config.BatchSize,
maxWorkers: int64(maxWorkers),
@@ -579,7 +579,7 @@ func (h *Target) SendFromStore(key store.Key) (err error) {
// Send the log message 'entry' to the http target.
// Messages are queued in the disk if the store is enabled
// If Cancel has been called the message is ignored.
func (h *Target) Send(ctx context.Context, entry interface{}) error {
func (h *Target) Send(ctx context.Context, entry any) error {
if h.status.Load() == statusClosed {
if h.migrateTarget != nil {
return h.migrateTarget.Send(ctx, entry)