Fix all lint issues and update AGENTS.md workflow rules
- Fix stuttering type names (e.g. config.ConfigParams → config.Params) - Add doc comments to all exported types/functions/methods - Add package doc comments to all packages - Fix JSON tags to camelCase - Extract magic numbers to constants - Add blank lines per nlreturn/wsl_v5 rules - Use errors.Is() for error comparison - Unexport NewLoggingResponseWriter (not used externally) - Replace for-range on ctx.Done() with channel receive - Rename unused parameters to _ - AGENTS.md: all changes via feature branches, no direct main commits
This commit is contained in:
@@ -13,8 +13,8 @@ import (
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
// HealthcheckParams defines the dependencies for creating a Healthcheck.
|
||||
type HealthcheckParams struct {
|
||||
// Params defines the dependencies for creating a Healthcheck.
|
||||
type Params struct {
|
||||
fx.In
|
||||
|
||||
Globals *globals.Globals
|
||||
@@ -29,11 +29,11 @@ type Healthcheck struct {
|
||||
StartupTime time.Time
|
||||
|
||||
log *slog.Logger
|
||||
params *HealthcheckParams
|
||||
params *Params
|
||||
}
|
||||
|
||||
// New creates a new Healthcheck instance.
|
||||
func New(lc fx.Lifecycle, params HealthcheckParams) (*Healthcheck, error) {
|
||||
func New(lc fx.Lifecycle, params Params) (*Healthcheck, error) {
|
||||
s := new(Healthcheck)
|
||||
s.params = ¶ms
|
||||
s.log = params.Logger.Get()
|
||||
@@ -52,8 +52,8 @@ func New(lc fx.Lifecycle, params HealthcheckParams) (*Healthcheck, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// HealthcheckResponse is the JSON response returned by the health endpoint.
|
||||
type HealthcheckResponse struct {
|
||||
// Response is the JSON response returned by the health endpoint.
|
||||
type Response struct {
|
||||
Status string `json:"status"`
|
||||
Now string `json:"now"`
|
||||
UptimeSeconds int64 `json:"uptimeSeconds"`
|
||||
@@ -64,8 +64,8 @@ type HealthcheckResponse struct {
|
||||
}
|
||||
|
||||
// Healthcheck returns the current health status of the server.
|
||||
func (s *Healthcheck) Healthcheck() *HealthcheckResponse {
|
||||
resp := &HealthcheckResponse{
|
||||
func (s *Healthcheck) Healthcheck() *Response {
|
||||
resp := &Response{
|
||||
Status: "ok",
|
||||
Now: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
UptimeSeconds: int64(s.uptime().Seconds()),
|
||||
|
||||
Reference in New Issue
Block a user