Replace hardcoded values with named constants from common packages or make values configurable through environment variables or flags. This improves maintainability, reduces magic numbers, and enables runtime configuration.
Replace hardcoded values with named constants from common packages or make values configurable through environment variables or flags. This improves maintainability, reduces magic numbers, and enables runtime configuration.
Examples of good practices:
common.SyncOptionSkipDryRunOnMissingResource
instead of "SkipDryRunOnMissingResource=true"
dialTime := env.ParseDurationFromEnv("DIAL_TIMEOUT", 30*time.Second)
const defaultMaxChildren = 2
Avoid hardcoding configuration values directly in the code. Instead, centralize them in common packages or make them configurable through environment variables, command-line flags, or configuration files. This allows for easier testing, deployment flexibility, and reduces the risk of inconsistencies across the codebase.
Enter the URL of a public GitHub repository