mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-29 21:26:40 +08:00
a579357343
The runtime.GOOS switch compiled the syslog branch into Windows builds, where go-logging's syslog stub always returns an error. staticcheck therefore reported SA4023 at logger.go:95 on every Windows lint run, keeping `make lint-go` red on a clean main there while Linux CI never saw it. console_windows.go and console_other.go now pick the backend at build time, with each platform's behaviour unchanged. No test can observe build-tag selection: `golangci-lint run` on Windows goes from 1 issue to 0, and `GOOS=linux golangci-lint run ./internal/logger/...` stays clean.
15 lines
284 B
Go
15 lines
284 B
Go
//go:build windows
|
|
|
|
package logger
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/op/go-logging"
|
|
)
|
|
|
|
// newConsoleBackend logs to stderr: go-logging has no syslog on Windows.
|
|
func newConsoleBackend() (backend logging.Backend, includeTime bool) {
|
|
return logging.NewLogBackend(os.Stderr, "", 0), true
|
|
}
|