The installer uses magic numbers for task orchestration and hardcoded paths that limit system compatibility and maintainability.
Identified Problems:
1. Magic Numbers for Installation Locks
- In
setup/apply.go and utils/locks.go, large numbers like 202501131200 and 202402081552 are used as identifiers for installation steps and locks.
- Impact: These values are arbitrary and lack semantic meaning, making the installation sequence hard to maintain or modify without breaking things.
2. Hardcoded System Paths
- Paths like
/root/utmstack.yml, /utmstack, and /var/log/utmstack-installer.log are hardcoded throughout the codebase.
- Impact: This violates Linux FHS (Filesystem Hierarchy Standard) and makes the installer inflexible for users who want to use different partitions or follow standard security practices (e.g., not running everything in
/root).
3. Antipatron "Utility Class"
- The
utils package is overloaded with unrelated responsibilities: network, cryptography, file system, command execution, and template rendering.
- Impact: Low cohesion and difficult to find specific functionality.
Recommended Actions:
- Replace magic numbers with named constants or a proper migration/task naming system.
- Use configurable paths or standard directories (e.g.,
/etc/utmstack, /var/lib/utmstack).
- Refactor the
utils package into smaller, cohesive packages (e.g., pkg/fs, pkg/net, pkg/exec).
The installer uses magic numbers for task orchestration and hardcoded paths that limit system compatibility and maintainability.
Identified Problems:
1. Magic Numbers for Installation Locks
setup/apply.goandutils/locks.go, large numbers like202501131200and202402081552are used as identifiers for installation steps and locks.2. Hardcoded System Paths
/root/utmstack.yml,/utmstack, and/var/log/utmstack-installer.logare hardcoded throughout the codebase./root).3. Antipatron "Utility Class"
utilspackage is overloaded with unrelated responsibilities: network, cryptography, file system, command execution, and template rendering.Recommended Actions:
/etc/utmstack,/var/lib/utmstack).utilspackage into smaller, cohesive packages (e.g.,pkg/fs,pkg/net,pkg/exec).