[go_toolchain] Fix VERSION file parsing

The Go repo's VERSION file now contains a timestamp on the second line
in addition to the version number on the first line, make sure to only
use the first line.

Change-Id: I5bc7c7651d84c93fb8dbe6ba605903189e11446e
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/recipes/+/1036714
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Adam Perry <adamperry@google.com>
Fuchsia-Auto-Submit: Oliver Newman <olivernewman@google.com>
diff --git a/recipes/contrib/go_toolchain.expected/ci-amd64.json b/recipes/contrib/go_toolchain.expected/ci-amd64.json
index ed35eb8..edb34fa 100644
--- a/recipes/contrib/go_toolchain.expected/ci-amd64.json
+++ b/recipes/contrib/go_toolchain.expected/ci-amd64.json
@@ -1455,6 +1455,7 @@
     "name": "read go version",
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@VERSION@go1.8@@@",
+      "@@@STEP_LOG_LINE@VERSION@blah@@@",
       "@@@STEP_LOG_END@VERSION@@@"
     ]
   },
diff --git a/recipes/contrib/go_toolchain.py b/recipes/contrib/go_toolchain.py
index 747b97b..6882a61 100644
--- a/recipes/contrib/go_toolchain.py
+++ b/recipes/contrib/go_toolchain.py
@@ -141,9 +141,14 @@
     if api.buildbucket_util.is_dev_or_try:
         return
 
-    go_version = api.file.read_text(
-        "read go version", go_dir / "VERSION", test_data="go1.8"
-    ).strip()
+    go_version = (
+        api.file.read_text(
+            "read go version", go_dir / "VERSION", test_data="go1.8\nblah"
+        ).strip()
+        # The VERSION file may contain multiple lines, only the first line
+        # should be considered as the version.
+        .splitlines()[0]
+    )
     assert go_version, "Cannot determine Go version"
 
     api.cipd_util.upload_package(