mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-08 03:59:33 +08:00
Add support for go
This commit is contained in:
parent
4c1d45cd01
commit
8a8483870b
@ -37,7 +37,7 @@ set <target> <mirror> # 换源,指定使用某镜像站
|
|||||||
- [x] `chsrc set perl` 或 `chsrc set cpan`
|
- [x] `chsrc set perl` 或 `chsrc set cpan`
|
||||||
- [x] `chsrc set php` 或 `chsrc composer`
|
- [x] `chsrc set php` 或 `chsrc composer`
|
||||||
|
|
||||||
- [ ] `chsrc set go`
|
- [x] `chsrc set go`
|
||||||
- [ ] `chsrc set rust` 或 `chsrc set cargo` 或 `chsrc crate`
|
- [ ] `chsrc set rust` 或 `chsrc set cargo` 或 `chsrc crate`
|
||||||
- [ ] `chsrc set java` 或 `chsrc set maven` 或 `chsrc set mvn` 或 `chsrc gradle`
|
- [ ] `chsrc set java` 或 `chsrc set maven` 或 `chsrc set mvn` 或 `chsrc gradle`
|
||||||
|
|
||||||
|
14
chsrc.c
14
chsrc.c
@ -144,8 +144,6 @@ common_cesu_ (source_info* sources, size_t size)
|
|||||||
for (int i=0;i<size;i++)
|
for (int i=0;i<size;i++)
|
||||||
{
|
{
|
||||||
source_info src = sources[i];
|
source_info src = sources[i];
|
||||||
// const char* baseurl = src.url;
|
|
||||||
// char* url = xy_2strjoin(baseurl, place);
|
|
||||||
const char* url = src.mirror->__bigfile_url;
|
const char* url = src.mirror->__bigfile_url;
|
||||||
if (NULL==url) {
|
if (NULL==url) {
|
||||||
xy_warn ("chsrc: 跳过该站点");
|
xy_warn ("chsrc: 跳过该站点");
|
||||||
@ -154,10 +152,9 @@ common_cesu_ (source_info* sources, size_t size)
|
|||||||
speed = test_speed (url);
|
speed = test_speed (url);
|
||||||
}
|
}
|
||||||
speeds[i] = speed;
|
speeds[i] = speed;
|
||||||
printf("%d %d\n", i, size);
|
|
||||||
}
|
}
|
||||||
int fastidx = dblary_maxidx (speeds, size);
|
int fastidx = dblary_maxidx (speeds, size);
|
||||||
xy_success (xy_2strjoin("最快镜像站为: ", sources[fastidx].mirror->name));
|
xy_success (xy_2strjoin("chsrc: 最快镜像站: ", sources[fastidx].mirror->name));
|
||||||
return fastidx;
|
return fastidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,16 +467,13 @@ _pl_go_check_cmd ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TODO: 暂未实现 */
|
|
||||||
void
|
void
|
||||||
pl_go_getsrc (char* option)
|
pl_go_getsrc (char* option)
|
||||||
{
|
{
|
||||||
_pl_go_check_cmd ();
|
_pl_go_check_cmd ();
|
||||||
|
|
||||||
// char* cmd = "npm config get registry";
|
char* cmd = "go env GOPROXY";
|
||||||
// system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -948,7 +942,7 @@ target_info
|
|||||||
pl_nodejs_target = {pl_nodejs_setsrc, NULL, pl_nodejs_sources, pl_nodejs_sources_n},
|
pl_nodejs_target = {pl_nodejs_setsrc, NULL, pl_nodejs_sources, pl_nodejs_sources_n},
|
||||||
pl_perl_target = {pl_perl_setsrc, NULL, pl_perl_sources, pl_perl_sources_n},
|
pl_perl_target = {pl_perl_setsrc, NULL, pl_perl_sources, pl_perl_sources_n},
|
||||||
pl_rust_target = {pl_rust_setsrc, NULL, pl_rust_sources, pl_rust_sources_n},
|
pl_rust_target = {pl_rust_setsrc, NULL, pl_rust_sources, pl_rust_sources_n},
|
||||||
pl_go_target = {pl_go_setsrc, NULL, pl_go_sources, pl_go_sources_n},
|
pl_go_target = {pl_go_setsrc, pl_go_getsrc, pl_go_sources, pl_go_sources_n},
|
||||||
pl_dotnet_target = {pl_dotnet_setsrc, NULL, pl_dotnet_sources, pl_dotnet_sources_n},
|
pl_dotnet_target = {pl_dotnet_setsrc, NULL, pl_dotnet_sources, pl_dotnet_sources_n},
|
||||||
pl_java_target = {pl_java_setsrc, NULL, pl_java_sources, pl_java_sources_n},
|
pl_java_target = {pl_java_setsrc, NULL, pl_java_sources, pl_java_sources_n},
|
||||||
pl_php_target = {pl_php_setsrc, pl_php_getsrc, pl_php_sources, pl_php_sources_n},
|
pl_php_target = {pl_php_setsrc, pl_php_getsrc, pl_php_sources, pl_php_sources_n},
|
||||||
|
8
chsrc.h
8
chsrc.h
@ -91,9 +91,11 @@ mirror_info
|
|||||||
RubyChina = {"rubychina", "RubyChina", "Ruby China 社区", "https://gems.ruby-china.com/",
|
RubyChina = {"rubychina", "RubyChina", "Ruby China 社区", "https://gems.ruby-china.com/",
|
||||||
"https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem"}, // 9.9 MB
|
"https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem"}, // 9.9 MB
|
||||||
|
|
||||||
GoProxyCN = {"goproxy.cn", "Goproxy.cn", "七牛云 Goproxy.cn", "https://goproxy.cn/", NULL},
|
GoProxyCN = {"goproxy.cn", "Goproxy.cn", "七牛云 Goproxy.cn", "https://goproxy.cn/",
|
||||||
|
"https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"}, // 30 MB
|
||||||
|
|
||||||
GoProxyIO = {"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/", NULL},
|
GoProxyIO = {"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/",
|
||||||
|
"https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"}, // 30 MB
|
||||||
|
|
||||||
NugetOrg = {"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/", NULL};
|
NugetOrg = {"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/", NULL};
|
||||||
|
|
||||||
@ -386,7 +388,6 @@ os_mysys2_sources[] = {
|
|||||||
int
|
int
|
||||||
dblary_maxidx(double* array, int size)
|
dblary_maxidx(double* array, int size)
|
||||||
{
|
{
|
||||||
puts("here");
|
|
||||||
double maxval = array[0];
|
double maxval = array[0];
|
||||||
double maxidx = 0;
|
double maxidx = 0;
|
||||||
|
|
||||||
@ -396,7 +397,6 @@ dblary_maxidx(double* array, int size)
|
|||||||
maxidx = i;
|
maxidx = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
puts("hello");
|
|
||||||
return maxidx;
|
return maxidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user