From e8fc52950e7b8a79770addeb134d278d25a1521b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 26 Jan 2024 08:10:34 -0800 Subject: print various environments variable from CI CI is currently failing with the following error: ``` go: errors parsing go.mod: /home/runner/work/world/world/go.mod:3: invalid go version '1.21.4': must match format 1.23 ``` From [1]: > Before Go 1.21, the initial release of a Go toolchain was version 1.N, not 1.N.0 which makes me think that I'm CI is running with a version of go older than 1.21, while I specify 1.21 in my nix config. If that's the case, something is not correct in the CI environment and I should fix it. Hopefully the script will give me the information I need to debug this. [1] https://go.dev/doc/toolchain#version --- ci/build-environment.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 ci/build-environment.py (limited to 'ci/build-environment.py') diff --git a/ci/build-environment.py b/ci/build-environment.py new file mode 100755 index 0000000..64a827a --- /dev/null +++ b/ci/build-environment.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +from shutil import which +import subprocess + + +def go_version(): + print("go information:") + + path = which("go") + print(f" path={path}") + + cmd = subprocess.run([path, "version"], capture_output=True, text=True) + # output is `go version go1.21.5 darwin/arm64`, we want the version and architecture + version = cmd.stdout.rstrip().split() + print(f" version={version[2]}") + print(f" architecture={version[3]}") + + +def main(): + go_version() + + +if __name__ == "__main__": + main() -- cgit v1.2.3