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).
This commit is contained in:
AJ ONeal 2026-03-01 00:37:24 -07:00
parent f3eff585c4
commit e6f82ed91b
No known key found for this signature in database

View File

@ -321,6 +321,8 @@ func initModuleGroup(group *moduleGroup, dryRun bool) {
if dryRun { if dryRun {
if isChanged { if isChanged {
fmt.Fprintf(os.Stderr, "[dry-run] would write %s\n", yamlPath) 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 { } else if isChanged {
if err := os.WriteFile(yamlPath, []byte(yamlContent), 0o644); err != nil { 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) 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 // 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) fatalf("writing %s: %v", yamlPath, err)
} }
fmt.Fprintf(os.Stderr, "wrote %s\n", yamlPath) 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. // 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, "'", "'\\''") + "'" 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 { func normalizeGitURL(rawURL string) string {
rawURL = strings.TrimSpace(rawURL) rawURL = strings.TrimSpace(rawURL)
rawURL = strings.TrimSuffix(rawURL, ".git") rawURL = strings.TrimSuffix(rawURL, ".git")