Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion commands/daemon.status.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func commandDaemonStatus(c *cli.Context) error {
fmt.Printf(" Socket Path: %s\n", socketPath)

if cfg.CCOtel != nil && cfg.CCOtel.Enabled != nil && *cfg.CCOtel.Enabled {
fmt.Printf(" CCOtel: enabled (port %d)\n", cfg.CCOtel.GRPCPort)
debugStatus := "off"
if cfg.CCOtel.Debug != nil && *cfg.CCOtel.Debug {
debugStatus = "on"
}
Comment on lines +68 to +70
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for checking the nullable boolean cfg.CCOtel.Debug is correct. However, this pattern of checking ptr != nil && *ptr is used multiple times in this file (e.g., for CCOtel.Enabled, CCOtel.Debug, and CodeTracking.Enabled). To improve code clarity and maintainability by reducing repetition, consider abstracting this logic into a helper function.

For example:

// isTrue checks if a *bool is non-nil and true.
func isTrue(b *bool) bool {
    return b != nil && *b
}

This would allow you to simplify these checks to if isTrue(cfg.CCOtel.Debug). Since this pattern is becoming more common in the codebase, introducing a helper function would be a good maintainability improvement.

fmt.Printf(" CCOtel: enabled (port %d, debug %s)\n", cfg.CCOtel.GRPCPort, debugStatus)
} else {
fmt.Println(" CCOtel: disabled")
}
Expand Down