Skip to content

Commit b0259dc

Browse files
committed
Install golang based on system architecture
1 parent e7fdd23 commit b0259dc

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

multiversx_sdk_cli/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ def get_defaults() -> dict[str, Any]:
129129
return {
130130
"dependencies.golang.resolution": "SDK",
131131
"dependencies.golang.tag": "go1.23.10",
132-
"dependencies.golang.urlTemplate.linux": "https://golang.org/dl/{TAG}.linux-amd64.tar.gz",
133-
"dependencies.golang.urlTemplate.osx": "https://golang.org/dl/{TAG}.darwin-amd64.tar.gz",
134-
"dependencies.golang.urlTemplate.windows": "https://golang.org/dl/{TAG}.windows-amd64.zip",
132+
"dependencies.golang.urlTemplate.linux": "https://golang.org/dl/{TAG}.linux-{ARCH}.tar.gz",
133+
"dependencies.golang.urlTemplate.osx": "https://golang.org/dl/{TAG}.darwin-{ARCH}.tar.gz",
134+
"dependencies.golang.urlTemplate.windows": "https://golang.org/dl/{TAG}.windows-{ARCH}.zip",
135135
"dependencies.testwallets.tag": "v1.0.0",
136136
"dependencies.testwallets.urlTemplate.linux": "https://github.com/multiversx/mx-sdk-testwallets/archive/{TAG}.tar.gz",
137137
"dependencies.testwallets.urlTemplate.osx": "https://github.com/multiversx/mx-sdk-testwallets/archive/{TAG}.tar.gz",

multiversx_sdk_cli/dependencies/modules.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import platform
23
import os
34
import shutil
45
from os import path
@@ -122,13 +123,22 @@ def get_parent_directory(self) -> Path:
122123
return config.get_dependency_parent_directory(self.key)
123124

124125
def _get_download_url(self, tag: str) -> str:
125-
platform = workstation.get_platform()
126+
plat = workstation.get_platform()
126127

127-
url = config.get_dependency_url(self.key, tag, platform)
128+
url = config.get_dependency_url(self.key, tag, plat)
128129
if not url:
129-
raise errors.PlatformNotSupported(self.key, platform)
130-
131-
url = url.replace("{TAG}", tag)
130+
raise errors.PlatformNotSupported(self.key, plat)
131+
132+
machine = platform.machine().lower()
133+
arch_map = {
134+
"x86_64": "amd64",
135+
"amd64": "amd64",
136+
"aarch64": "arm64",
137+
"arm64": "arm64",
138+
}
139+
arch = arch_map.get(machine, "amd64")
140+
141+
url = url.replace("{TAG}", tag).replace("{ARCH}", arch)
132142
return url
133143

134144
def _get_archive_path(self, tag: str) -> Path:

0 commit comments

Comments
 (0)