blob: 64a827adbae50968a5efc04ccb3312816dd398ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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()
|