1 Star 0 Fork 0

蒙蒙的男孩 / eosc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
version.go 881 Bytes
一键复制 编辑 原始数据 按行查看 历史
蒙蒙的男孩 提交于 2024-01-10 13:49 . 重定义项目地址
package extends
import (
"fmt"
"runtime"
"strings"
"gitee.com/meng_mengs_boys/eosc"
)
type VersionInfo struct {
Version string `json:"version"`
Description string `json:"description"`
IsLatest bool `json:"is_latest"`
}
func GetAvailableVersions(group, project string) ([]*VersionInfo, error) {
plugins, err := ExtendersRequest(group, project)
if err != nil {
return nil, err
}
//var latest *VersionInfo
versions := make([]*VersionInfo, 0, len(plugins))
arch := Arch()
for _, p := range plugins {
for _, a := range p.Arches {
if a == arch {
versions = append(versions, p.VersionInfo)
break
}
}
}
return versions, nil
}
// Arch 当前架构环境,[{go版本}-{eosc版本}-{架构}]
func Arch() string {
return fmt.Sprintf("%s-%s-%s-%s", strings.TrimPrefix(runtime.Version(), "go"), eosc.Version(), runtime.GOOS, runtime.GOARCH)
}
1
https://gitee.com/meng_mengs_boys/eosc.git
git@gitee.com:meng_mengs_boys/eosc.git
meng_mengs_boys
eosc
eosc
v1.15.7

搜索帮助