优化代码

main
15128022404 2 years ago
parent b7b913bc74
commit 12cb0167d0

@ -16,6 +16,7 @@ import (
) )
func fundVersion(version string) *collector.GradleItem { func fundVersion(version string) *collector.GradleItem {
collector.Init()
rs := collector.Collector.Items rs := collector.Collector.Items
for _, v := range rs { for _, v := range rs {
if v.Version == version { //strings.Contains(v.SimpleName, version) if v.Version == version { //strings.Contains(v.SimpleName, version)

@ -28,6 +28,7 @@ func remoteVersionLength2(version string) string {
func listRemote(*cli.Context) (err error) { func listRemote(*cli.Context) (err error) {
use_version := inuse(goroot) use_version := inuse(goroot)
out := ansi.NewAnsiStdout() out := ansi.NewAnsiStdout()
collector.Init()
rs := collector.Collector.Items rs := collector.Collector.Items
color.New(color.FgGreen).Fprintf(out, " %s\n", " version info RelaseTime") color.New(color.FgGreen).Fprintf(out, " %s\n", " version info RelaseTime")
for _, v := range rs { for _, v := range rs {

@ -22,7 +22,7 @@ type GradleItem struct {
DownloadUrl string DownloadUrl string
} }
func init() { func Init() {
Collector = &GradleCollector{ Collector = &GradleCollector{
Items: getGradleAllInfo(), Items: getGradleAllInfo(),
} }

@ -17,33 +17,33 @@ build-all: build-linux build-darwin build-windows
build-linux: build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x build-linux: build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x
build-linux-386: build-linux-386:
GOOS=linux GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/linux-386/j GOOS=linux GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/linux-386/grvm
build-linux-amd64: build-linux-amd64:
GOOS=linux GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/linux-amd64/linux_amd_x86_64_j GOOS=linux GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/linux-amd64/linux_amd_x86_64_grvm
build-linux-arm: build-linux-arm:
GOOS=linux GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/linux-arm/j GOOS=linux GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/linux-arm/grvm
build-linux-arm64: build-linux-arm64:
GOOS=linux GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/linux-arm64/j GOOS=linux GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/linux-arm64/grvm
build-linux-s390x: build-linux-s390x:
GOOS=linux GOARCH=s390x $(GO) build $(GO_FLAGS) -o bin/linux-s390x/j GOOS=linux GOARCH=s390x $(GO) build $(GO_FLAGS) -o bin/linux-s390x/grvm
build-darwin: build-darwin-amd64 build-darwin-arm64 build-darwin: build-darwin-amd64 build-darwin-arm64
build-darwin-amd64: build-darwin-amd64:
GOOS=darwin GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/darwin-amd64/j GOOS=darwin GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/darwin-amd64/grvm
build-darwin-arm64: build-darwin-arm64:
GOOS=darwin GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/darwin-arm64/j GOOS=darwin GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/darwin-arm64/grvm
build-windows: build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64 build-windows: build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64
build-windows-386: build-windows-386:
GOOS=windows GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/windows-386/j.exe GOOS=windows GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/windows-386/grvm.exe
build-windows-amd64: build-windows-amd64:
GOOS=windows GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/windows-amd64/windows_amd_x86_64_j.exe GOOS=windows GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/windows-amd64/windows_amd_x86_64_grvm.exe
build-windows-arm: build-windows-arm:
GOOS=windows GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/windows-arm/j.exe GOOS=windows GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/windows-arm/grvm.exe
build-windows-arm64: build-windows-arm64:
GOOS=windows GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/windows-arm64/j.exe GOOS=windows GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/windows-arm64/grvm.exe
package: package:
sh ./package.sh sh ./package.sh

Loading…
Cancel
Save