bneradt commented on code in PR #13213:
URL: https://github.com/apache/trafficserver/pull/13213#discussion_r3365962396
##########
tests/gold_tests/autest-site/conditions.test.ext:
##########
@@ -217,6 +231,29 @@ def HasProxyVerifierVersion(self, version):
return self.EnsureVersion([verifier_path, "--version"],
min_version=version)
+def HasGoVersion(self, version):
+ """Check whether the go command is available at the requested version."""
+
+ def version_tuple(value):
+ return tuple(int(part) for part in value.split('.'))
+
+ def check_go_version():
+ try:
+ output = subprocess.check_output(["go", "version"],
stderr=subprocess.STDOUT, text=True)
+ except (OSError, subprocess.SubprocessError):
+ return False
+
+ match = re.search(r'\bgo(\d+\.\d+(?:\.\d+)?)\b', output)
+ if match is None:
+ return False
+
+ found = version_tuple(match.group(1))
+ required = version_tuple(version)
+ return found >= required
+
+ return self.Condition(check_go_version, "Go must be installed and at least
version " + version)
Review Comment:
Fixed. HasGoVersion() now uses the same padded _version_tuple() helper, so
go1.24 satisfies a 1.24.0 requirement instead of failing due to unequal tuple
length comparison.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]