Skip to content

Prevent a warning being printed when parsing config#62

Merged
SUSTAPLE117 merged 1 commit into
mainfrom
maint/fixConfigParseBin
Jun 19, 2026
Merged

Prevent a warning being printed when parsing config#62
SUSTAPLE117 merged 1 commit into
mainfrom
maint/fixConfigParseBin

Conversation

@SUSTAPLE117

Copy link
Copy Markdown
Contributor

Added after the #60 fix so we don't see a warning when it tries to parse the binary itself as a config file

Copilot AI review requested due to automatic review settings June 18, 2026 20:27

Copilot AI left a comment

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.

Pull request overview

This PR prevents Viper’s config auto-discovery from matching an extensionless file named bagel (notably the ./bagel binary when running from its directory), which previously caused YAML parse warnings/errors during config loading.

Changes:

  • Stop calling SetConfigType("yaml") during config auto-discovery so only bagel.<ext> files are considered.
  • Add a regression test intended to ensure the extensionless bagel binary is not parsed as config.
  • Mirror the same “no SetConfigType” behavior in CLI startup config initialization.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/config/config.go Removes SetConfigType during auto-discovery to avoid matching an extensionless bagel file (the binary).
pkg/config/config_test.go Adds a regression test for the extensionless-binary matching scenario (currently needs adjustment to assert on the real log message).
cmd/bagel/root.go Removes SetConfigType from CLI initConfig auto-discovery path and documents rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/config/config_test.go
@SUSTAPLE117 SUSTAPLE117 merged commit 22a28b0 into main Jun 19, 2026
7 checks passed
@SUSTAPLE117 SUSTAPLE117 deleted the maint/fixConfigParseBin branch June 19, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants