Files
OpenFlare/backend/cmd/banner.go
T
ryan 528240026d chore(lint): unify formatting on golangci-lint fmt (gofumpt), uncap issue reporting, fix gofumpt drift
- make format 现在与 code-check 使用同一格式化器(golangci-lint fmt),消除 goimports -local 与 gofumpt 的格式拉锯
- .golangci.yml 关闭默认 50/3 截断,完整上报所有问题(只增强不弱化)
- 全库 gofumpt 规范化(203 files, 纯格式无行为变更)
2026-08-28 16:31:53 +08:00

54 lines
1.3 KiB
Go

// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
// Package cmd provides CLI command entry points.
//
//nolint:unused
package cmd
import (
"Wavelet/pkg/buildinfo"
"Wavelet/pkg/config"
"fmt"
"runtime"
"strings"
)
//nolint:unused // 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
}