chore: default platform

This commit is contained in:
zijiren233 2024-08-10 12:56:28 +08:00
parent 624e4557c9
commit aad84887bb
2 changed files with 22 additions and 7 deletions

View File

@ -39,7 +39,16 @@ function printDepEnvHelp() {
}
function initDepPlatforms() {
return 0
clearAllowedPlatforms
addAllowedPlatforms "linux/386,linux/amd64,linux/arm,linux/arm64,linux/loong64,linux/mips,linux/mips64,linux/mips64le,linux/mipsle,linux/ppc64le,linux/riscv64,linux/s390x"
addAllowedPlatforms "darwin/amd64,darwin/arm64"
addAllowedPlatforms "windows/386,windows/amd64,windows/arm64"
addAllowedPlatforms "freebsd/386,freebsd/amd64,freebsd/arm,freebsd/arm64"
addAllowedPlatforms "netbsd/amd64"
addAllowedPlatforms "openbsd/amd64,openbsd/arm64"
addAllowedPlatforms "${GOHOSTOS}/${GOHOSTARCH}"
}
function initDep() {

View File

@ -257,17 +257,23 @@ function deleteAllowedPlatforms() {
ALLOWED_PLATFORMS=$(echo "${ALLOWED_PLATFORMS}" | sed "s|${1}$||g" | sed "s|${1},||g")
}
# Clears the allowed platforms list.
function clearAllowedPlatforms() {
ALLOWED_PLATFORMS=""
}
# Initializes the platforms based on environment variables and allowed platforms.
# go tool dist list
function initPlatforms() {
setDefault "CGO_ENABLED" "${DEFAULT_CGO_ENABLED}"
addAllowedPlatforms "linux/386,linux/amd64,linux/arm,linux/arm64,linux/loong64,linux/mips,linux/mips64,linux/mips64le,linux/mipsle,linux/ppc64le,linux/riscv64,linux/s390x"
addAllowedPlatforms "darwin/amd64,darwin/arm64"
addAllowedPlatforms "windows/386,windows/amd64,windows/arm64"
addAllowedPlatforms "freebsd/386,freebsd/amd64,freebsd/arm,freebsd/arm64"
addAllowedPlatforms "netbsd/amd64"
addAllowedPlatforms "openbsd/amd64,openbsd/arm64"
local distList="$(go tool dist list)"
addAllowedPlatforms "$(echo "$distList" | grep windows)"
addAllowedPlatforms "$(echo "$distList" | grep linux)"
addAllowedPlatforms "$(echo "$distList" | grep darwin)"
addAllowedPlatforms "$(echo "$distList" | grep netbsd)"
addAllowedPlatforms "$(echo "$distList" | grep freebsd)"
addAllowedPlatforms "$(echo "$distList" | grep openbsd)"
addAllowedPlatforms "${GOHOSTOS}/${GOHOSTARCH}"