mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 14:46:36 +08:00
ad8384182c
24 of the 96 nolint directives were dead: they covered findings that no longer exist. A stale suppression is not inert — it silently claims any future finding for that linter in that scope, so a real problem raised there would vanish without anyone noticing. Explanatory prose was kept as ordinary comments. Two directives proved load-bearing under the project gate even though nolintlint reported them unused, and removing them exposed verified contextcheck false positives: App.Run does forward a sigCtx derived from the caller's context to Start, and the migration lock renewal must keep its own deadline because the task context may already be canceled. Both were restored, narrowed to the live linter, and given the reason the originals lacked.
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Package cmd provides CLI command entry points.
|
|
package cmd
|
|
|
|
import (
|
|
"Wavelet/pkg/buildinfo"
|
|
"Wavelet/pkg/config"
|
|
"fmt"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// startup banner formatting utilities
|
|
type startupState struct {
|
|
mode string
|
|
listensForHTTP bool
|
|
}
|
|
|
|
func printStartupBanner(state startupState) {
|
|
fmt.Println(formatStartupBanner(state))
|
|
}
|
|
|
|
func formatStartupBanner(state startupState) string {
|
|
lines := []string{
|
|
"",
|
|
"__ __ _ _ ",
|
|
"\\ \\ / /_ ___ _____ | | ___| |_ ",
|
|
" \\ \\ /\\ / / _` \\ \\ / / _ \\ | |/ _ \\ __|",
|
|
" \\ V V / (_| |\\ V / __/ | | __/ |_ ",
|
|
" \\_/\\_/ \\__,_| \\_/ \\___|_|\\___|\\__|",
|
|
fmt.Sprintf(" Wavelet %s", buildinfo.Version),
|
|
"",
|
|
fmt.Sprintf(" Environment: %s", config.Config.App.Env),
|
|
fmt.Sprintf(" Runtime: %s/%s (%s)", runtime.GOOS, runtime.GOARCH, runtime.Version()),
|
|
fmt.Sprintf(" Build time: %s", buildTime()),
|
|
}
|
|
if state.listensForHTTP {
|
|
lines = append(lines, fmt.Sprintf(" Listening: http://%s", config.Config.App.Addr))
|
|
}
|
|
lines = append(lines, fmt.Sprintf(" Mode: %s", state.mode), "")
|
|
return strings.Join(lines, "\n")
|
|
}
|
|
|
|
func buildTime() string {
|
|
if buildinfo.BuildTime == "" {
|
|
return "development build"
|
|
}
|
|
return buildinfo.BuildTime
|
|
}
|