From e6f82ed91b27ebb797056d3ccc69b7e436517b1b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 1 Mar 2026 00:37:24 -0700 Subject: [PATCH] feat(monorel): print "found config ... with monorepo support" when yaml is ok When an existing .goreleaser.yaml passes yamlLooksCorrect() and needs no update, both init and release now print: found config ./cmd/tcpfwd/.goreleaser.yaml with monorepo support Path is shown relative to cwd (via cwdRelPath helper). --- tools/monorel/main.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/monorel/main.go b/tools/monorel/main.go index 5859c15..706fa2b 100644 --- a/tools/monorel/main.go +++ b/tools/monorel/main.go @@ -321,6 +321,8 @@ func initModuleGroup(group *moduleGroup, dryRun bool) { if dryRun { if isChanged { fmt.Fprintf(os.Stderr, "[dry-run] would write %s\n", yamlPath) + } else { + fmt.Fprintf(os.Stderr, "found config %s with monorepo support\n", cwdRelPath(yamlPath)) } } else if isChanged { if err := os.WriteFile(yamlPath, []byte(yamlContent), 0o644); err != nil { @@ -338,6 +340,8 @@ func initModuleGroup(group *moduleGroup, dryRun bool) { fmt.Fprintf(os.Stderr, "committed: %s\n", commitMsg) } } + } else { + fmt.Fprintf(os.Stderr, "found config %s with monorepo support\n", cwdRelPath(yamlPath)) } // 3. Bump patch — but only when the goreleaser.yaml commit is the sole new @@ -984,6 +988,8 @@ func processModule(group *moduleGroup, relPath string) { fatalf("writing %s: %v", yamlPath, err) } fmt.Fprintf(os.Stderr, "wrote %s\n", yamlPath) + } else { + fmt.Fprintf(os.Stderr, "found config %s with monorepo support\n", cwdRelPath(yamlPath)) } // 2. Auto-commit + auto-tag — only when the file was newly created. @@ -1411,6 +1417,20 @@ func shellSingleQuote(s string) string { return "'" + strings.ReplaceAll(s, "'", "'\\''") + "'" } +// relPath returns path relative to the current working directory, prefixed +// with "./". Falls back to the absolute path if cwd cannot be determined. +func cwdRelPath(path string) string { + cwd, err := os.Getwd() + if err != nil { + return path + } + rel, err := filepath.Rel(cwd, path) + if err != nil { + return path + } + return "./" + rel +} + func normalizeGitURL(rawURL string) string { rawURL = strings.TrimSpace(rawURL) rawURL = strings.TrimSuffix(rawURL, ".git")