Skip to content

Commit 43bbbb8

Browse files
committed
fix(commands): drop double-print of modeline parse failures in root.go
Address review feedback from gemini-code-assist on root.go:255 and coderabbitai on root.go:257 (same site, two reviewers). processModelineAndUpdateGlobals printed 'Warning: modeline parsing failed: <err>' to stderr AND returned errors.Wrapf(err, ...). The caller threads that wrapped error up to cobra, which surfaces it through its own stderr writer at command-end. Operators saw the same underlying error twice — once with a misleading 'Warning:' prefix, once with the proper command-error rendering. Drop the explicit Fprintf; let cobra surface the single wrapped error at the command boundary. Signed-off-by: Aleksei Sviridkin <f@lex.la>
1 parent 1ce809a commit 43bbbb8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pkg/commands/root.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package commands
1616

1717
import (
1818
"context"
19-
"fmt"
2019
"os"
2120
"path/filepath"
2221
"time"
@@ -251,8 +250,10 @@ func DetectRootForTemplate(templatePath string) (string, error) {
251250
func processModelineAndUpdateGlobals(configFile string, nodesFromArgs, endpointsFromArgs, overwrite bool) ([]string, error) {
252251
modelineConfig, err := modeline.ReadAndParseModeline(configFile)
253252
if err != nil {
254-
fmt.Fprintf(os.Stderr, "Warning: modeline parsing failed: %v\n", err)
255-
253+
// Don't print the error here — cobra surfaces the wrapped
254+
// return through stderr at the command level. Printing here
255+
// AND returning the wrap caused the same message to appear
256+
// twice with a misleading "Warning:" prefix on the first copy.
256257
return nil, errors.Wrapf(err, "parsing modeline in %s", configFile)
257258
}
258259

0 commit comments

Comments
 (0)