mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-04-22 03:48:53 +08:00
Split go out
This commit is contained in:
parent
6c53a19e2e
commit
bf1fb434ae
@ -112,12 +112,6 @@ MirrorSite
|
||||
// 注意,这个是跳转后的地址,不确定未来会不会改变
|
||||
"https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.10.0/tfjs-4.10.0.tgz"}, // 29MB
|
||||
|
||||
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/",
|
||||
"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},
|
||||
EmacsChina = {"emacschina", "EmacsChina", "Emacs China 社区", "https://elpamirror.emacs-china.org/", NULL};
|
||||
|
||||
@ -185,20 +179,6 @@ pl_php_sources[] = {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 2024-04-18 更新
|
||||
*
|
||||
* @note 缺少教育网软件源
|
||||
*/
|
||||
pl_go_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&GoProxyCN, "https://goproxy.cn"},
|
||||
{&Ali, "https://mirrors.aliyun.com/goproxy/"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/goproxy/"},
|
||||
{&GoProxyIO, "https://goproxy.io"}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 2024-05-24 更新
|
||||
*
|
||||
@ -863,7 +843,7 @@ wr_tex_sources[] = {
|
||||
|
||||
def_sources_n(pl_nodejs);
|
||||
def_sources_n(pl_perl); def_sources_n(pl_php);
|
||||
def_sources_n(pl_go); def_sources_n(pl_rust);
|
||||
def_sources_n(pl_rust);
|
||||
def_sources_n(pl_java); def_sources_n(pl_clojure);
|
||||
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);
|
||||
def_sources_n(pl_ocaml);
|
||||
|
45
src/chsrc.c
45
src/chsrc.c
@ -189,48 +189,7 @@ pl_php_setsrc (char *option)
|
||||
}
|
||||
|
||||
#include "recipe/lang/lua.c"
|
||||
|
||||
|
||||
void
|
||||
pl_go_check_cmd ()
|
||||
{
|
||||
char *check_cmd = xy_str_to_quietcmd ("go version");
|
||||
bool exist = query_program_exist (check_cmd, "go");
|
||||
|
||||
if (!exist)
|
||||
{
|
||||
chsrc_error ("未找到 go 相关命令,请检查是否存在");
|
||||
exit (Exit_UserCause);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pl_go_getsrc (char *option)
|
||||
{
|
||||
pl_go_check_cmd ();
|
||||
chsrc_run ("go env GOPROXY", RunOpt_Default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go换源,参考:https://goproxy.cn/
|
||||
*/
|
||||
void
|
||||
pl_go_setsrc (char *option)
|
||||
{
|
||||
pl_go_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_go);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *cmd = "go env -w GO111MODULE=on";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
#include "recipe/lang/go.c"
|
||||
|
||||
|
||||
void
|
||||
@ -2108,7 +2067,7 @@ wr_anaconda_setsrc (char *option)
|
||||
|
||||
/************************************** Begin Target Matrix ****************************************/
|
||||
def_target(pl_nodejs); def_target(pl_perl); def_target(pl_php);
|
||||
def_target(pl_rust); def_target(pl_go); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml);
|
||||
def_target(pl_rust); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml);
|
||||
def_target(pl_r); def_target(pl_julia);
|
||||
def_target_noget (pl_clojure);
|
||||
def_target_noget (pl_dotnet);
|
||||
|
74
src/recipe/lang/go.c
Normal file
74
src/recipe/lang/go.c
Normal file
@ -0,0 +1,74 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created on : <2023-09-30>
|
||||
* Last modified : <2024-08-09>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
|
||||
static MirrorSite
|
||||
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/",
|
||||
"https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"}; // 30 MB
|
||||
|
||||
|
||||
/**
|
||||
* @time 2024-04-18 更新
|
||||
* @note 缺少教育网软件源
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_go_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&GoProxyCN, "https://goproxy.cn"},
|
||||
{&Ali, "https://mirrors.aliyun.com/goproxy/"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/goproxy/"},
|
||||
{&GoProxyIO, "https://goproxy.io"}
|
||||
};
|
||||
def_sources_n(pl_go);
|
||||
|
||||
|
||||
|
||||
void
|
||||
pl_go_check_cmd ()
|
||||
{
|
||||
char *check_cmd = xy_str_to_quietcmd ("go version");
|
||||
bool exist = query_program_exist (check_cmd, "go");
|
||||
|
||||
if (!exist)
|
||||
{
|
||||
chsrc_error ("未找到 go 相关命令,请检查是否存在");
|
||||
exit (Exit_UserCause);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pl_go_getsrc (char *option)
|
||||
{
|
||||
pl_go_check_cmd ();
|
||||
chsrc_run ("go env GOPROXY", RunOpt_Default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Go换源,参考:https://goproxy.cn/
|
||||
*/
|
||||
void
|
||||
pl_go_setsrc (char *option)
|
||||
{
|
||||
pl_go_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_go);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *cmd = "go env -w GO111MODULE=on";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_go);
|
Loading…
x
Reference in New Issue
Block a user