fix: only error if config is directly provided#52
Conversation
📝 WalkthroughWalkthroughModified config initialization error handling in one file: added a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@cmd/ctrlc/ctrlc.go`:
- Around line 48-51: The code currently only sets configProvided = true when the
flag-backed variable cfgFile is non-empty, so the environment variable bound via
viper.BindEnv("config", ...) never causes the file to be treated as provided;
either explicitly read viper.GetString("config") into cfgFile (or set
configProvided) before the cfgFile check or remove the misleading
viper.BindEnv("config", ...) if env-based config file paths are not supported;
update the logic around cfgFile, configProvided, and the viper.SetConfigFile
call (functions/variables: cfgFile, configProvided, viper.BindEnv("config",
...), viper.SetConfigFile) so an env-provided path behaves the same as --config
or the env binding is removed.
Summary by CodeRabbit