From fa341a2ef0299e59ef98aed7fa1d2dc7a6f2f7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 29 Feb 2024 15:49:11 +0100 Subject: [PATCH] multimod: Fix to log 'Using versioning file' and 'Successfully deleted module tags' to stderr instead of stdout (#507) --- .chloggen/multimod-print-using-to-stderr.yaml | 16 ++++++++++++++++ Makefile | 2 +- multimod/cmd/prerelease.go | 3 +-- multimod/cmd/sync.go | 2 +- multimod/cmd/tag.go | 3 +-- multimod/cmd/verify.go | 3 +-- multimod/internal/tag/tag.go | 2 +- 7 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 .chloggen/multimod-print-using-to-stderr.yaml diff --git a/.chloggen/multimod-print-using-to-stderr.yaml b/.chloggen/multimod-print-using-to-stderr.yaml new file mode 100644 index 00000000..01fd21e4 --- /dev/null +++ b/.chloggen/multimod-print-using-to-stderr.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. crosslink) +component: multimod + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix to log 'Using versioning file' and 'Successfully deleted module tags' to stderr instead of stdout + +# One or more tracking issues related to the change +issues: [507] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/Makefile b/Makefile index 1684d1f1..1d9545f4 100644 --- a/Makefile +++ b/Makefile @@ -196,7 +196,7 @@ REMOTE?=git@github.com:open-telemetry/opentelemetry-go-build-tools.git .PHONY: push-tags push-tags: | $(MULTIMOD) $(MULTIMOD) verify - set -e; for tag in `$(MULTIMOD) tag -m tools -c ${COMMIT} --print-tags | grep -v "Using" `; do \ + set -e; for tag in `$(MULTIMOD) tag -m tools -c ${COMMIT} --print-tags `; do \ echo "pushing tag $${tag}"; \ git push ${REMOTE} $${tag}; \ done; diff --git a/multimod/cmd/prerelease.go b/multimod/cmd/prerelease.go index 17b62e02..65cc58c6 100644 --- a/multimod/cmd/prerelease.go +++ b/multimod/cmd/prerelease.go @@ -15,7 +15,6 @@ package cmd import ( - "fmt" "log" "github.com/spf13/cobra" @@ -55,7 +54,7 @@ var prereleaseCmd = &cobra.Command{ } }, Run: func(*cobra.Command, []string) { - fmt.Println("Using versioning file", versioningFile) + log.Println("Using versioning file", versioningFile) prerelease.Run(versioningFile, moduleSetNames, allModuleSets, skipGoModTidy, commitToDifferentBranch) }, diff --git a/multimod/cmd/sync.go b/multimod/cmd/sync.go index 0187e332..55d000b3 100644 --- a/multimod/cmd/sync.go +++ b/multimod/cmd/sync.go @@ -56,7 +56,7 @@ var syncCmd = &cobra.Command{ } }, Run: func(*cobra.Command, []string) { - fmt.Println("Using versioning file", versioningFile) + log.Println("Using versioning file", versioningFile) if otherVersioningFile == "" { otherVersioningFile = filepath.Join(otherRepoRoot, diff --git a/multimod/cmd/tag.go b/multimod/cmd/tag.go index 813b74a4..1cb13f74 100644 --- a/multimod/cmd/tag.go +++ b/multimod/cmd/tag.go @@ -15,7 +15,6 @@ package cmd import ( - "fmt" "log" "github.com/spf13/cobra" @@ -38,7 +37,7 @@ var tagCmd = &cobra.Command{ - Creates new Git tags for all modules being updated. - If tagging fails in the middle of the script, the recently created tags will be deleted.`, Run: func(*cobra.Command, []string) { - fmt.Println("Using versioning file", versioningFile) + log.Println("Using versioning file", versioningFile) tag.Run(versioningFile, moduleSetName, commitHash, deleteModuleSetTags, printTags) }, diff --git a/multimod/cmd/verify.go b/multimod/cmd/verify.go index b52d7fe7..df962fc8 100644 --- a/multimod/cmd/verify.go +++ b/multimod/cmd/verify.go @@ -15,7 +15,6 @@ package cmd import ( - "fmt" "log" "github.com/spf13/cobra" @@ -34,7 +33,7 @@ var verifyCmd = &cobra.Command{ - Script warns if any stable modules depend on any unstable modules. `, Run: func(*cobra.Command, []string) { - fmt.Println("Using versioning file", versioningFile) + log.Println("Using versioning file", versioningFile) verify.Run(versioningFile) }, diff --git a/multimod/internal/tag/tag.go b/multimod/internal/tag/tag.go index 68cb63ec..04123627 100644 --- a/multimod/internal/tag/tag.go +++ b/multimod/internal/tag/tag.go @@ -49,7 +49,7 @@ func Run(versioningFile, moduleSetName, commitHash string, deleteModuleSetTags b log.Fatalf("Error deleting tags for the specified module set: %v", err) } - fmt.Println("Successfully deleted module tags") + log.Println("Successfully deleted module tags") } else { if err := t.tagAllModules(nil); err != nil { log.Fatalf("unable to tag modules: %v", err)