diff mbox series

[3/4] recipetool: go: ignore 'go: *' log messages

Message ID 20240226144040.2007482-4-lukas.funke-oss@weidmueller.com
State New
Headers show
Series go: improve vendoring | expand

Commit Message

Lukas Funke Feb. 26, 2024, 2:40 p.m. UTC
From: Lukas Funke <lukas.funke@weidmueller.com>

Go will download verious modules during vendoring and tell us about
it, i.e. "go: downloading foo/bar vX.Y.Z". These lines are mixed with the
relevant modules.txt lines. Thus, ignore log messages starting with
"go: .*".

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
---
 scripts/lib/recipetool/create_go.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py
index abe1f6e0da..cae7175a33 100644
--- a/scripts/lib/recipetool/create_go.py
+++ b/scripts/lib/recipetool/create_go.py
@@ -615,10 +615,15 @@  class GoRecipeHandler(RecipeHandler):
         _, stderr = self.__go_run_cmd(
             "go mod vendor -v -o %s" % (tmp_vendor_dir), srctree, d)
 
+        # ignore miscellaneous go log messages
+        vedoring_log = [x for x in stderr.splitlines() \
+                            if not x.startswith("go: ")]
+
         modules_txt_basename = "modules.txt"
         modules_txt_filename = os.path.join(localfilesdir, modules_txt_basename)
         with open(modules_txt_filename, "w") as f:
-            f.write(stderr)
+            f.write('\n'.join(vedoring_log))
+            f.write('\n') # don't forget the trailing newline
 
         extravalues['extrafiles'][modules_txt_basename] = modules_txt_filename