Some checks failed
CI / build-and-test (push) Has been cancelled
Release / build (arm64, darwin) (push) Has been cancelled
Release / build (amd64, windows) (push) Has been cancelled
Release / build (arm64, linux) (push) Has been cancelled
Release / build (amd64, darwin) (push) Has been cancelled
Release / build (amd64, linux) (push) Has been cancelled
Release / release (push) Has been cancelled
Adds package-level documentation comments across cmd and internal packages. Marks unused function parameters with underscore prefix to satisfy linter requirements. Replaces if-else chains with switch statements for better readability. Explicitly ignores os.Setenv return value where error handling is not needed.
26 lines
663 B
Go
26 lines
663 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Package run provides the core runner functionality for executing tasks.
|
|
package run
|
|
|
|
import (
|
|
"io"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// NullLogger is used to create a new JobLogger to discard logs. This
|
|
// will prevent these logs from being logged to the stdout, but
|
|
// forward them to the Reporter via its hook.
|
|
type NullLogger struct{}
|
|
|
|
// WithJobLogger creates a new logrus.Logger that will discard all logs.
|
|
func (n NullLogger) WithJobLogger() *log.Logger {
|
|
logger := log.New()
|
|
logger.SetOutput(io.Discard)
|
|
logger.SetLevel(log.TraceLevel)
|
|
|
|
return logger
|
|
}
|