Ai
4 Star 8 Fork 4

爱折腾智能机器人/commands

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
update_go_source.sh 2.16 KB
一键复制 编辑 原始数据 按行查看 历史
爱折腾智能机器人 提交于 2023-10-10 17:09 +08:00 . fix go source
#!/bin/bash
################################################
# Function : Update GO source shell
# Desc : 用于更新GO源的脚本
# Platform : ubuntu
# Version : 1.0
# Date : 2022-06-24 15:17:32
# Author : ncnynl
# Contact : 1043931@qq.com
# URL: https://ncnynl.com
# QQ Qun: 创客智造B群:926779095
# QQ Qun: 创客智造C群:937347681
# QQ Qun: 创客智造D群:562093920
################################################
export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=commands
echo "$(gettext "Update go source shell")"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
SKYBLUE='\033[0;36m'
PLAIN='\033[0m'
setDefault()
{
if ! grep -Fq "GOPROXY=" ~/.bashrc
then
echo "go env -w GOPROXY=https://goproxy.io,direct" >> ~/.bashrc
echo "GOPROXY env have installed successfully! writed to ~/.bashrc"
else
proxy="goproxy.io"
sed -i "s/GOPROXY=https:\/\/.*,direct/GOPROXY=https:\/\/$proxy,direct/"g ~/.bashrc
fi
}
# 七牛 CDN
setQiniu()
{
proxy="goproxy.cn"
sed -i "s/GOPROXY=https:\/\/.*,direct/GOPROXY=https:\/\/$proxy,direct/"g ~/.bashrc
}
# 阿里云
setAliyun(){
proxy="mirrors.aliyun.com\/goproxy\/"
sed -i "s/GOPROXY=https:\/\/.*,direct/GOPROXY=https:\/\/$proxy,direct/"g ~/.bashrc
}
setSources(){
echo "请问你需要变更GO源? 不需要的话,直接回车即可"
echo "GO官方源请输入 - go"
echo "七牛GO源请输入 - qiniu"
echo "阿里云GO源请输入 - aliyun"
CHOICE_A=$(echo -e "\n Please input source :")
read -p "${CHOICE_A}" para
case $para in
'go'|'-go'|'--go' )
setDefault;;
'qiniu'|'-qiniu'|'--qiniu' )
setDefault;setQiniu;;
'aliyun'|'-aliyun'|'--aliyun' )
setDefault;setAliyun;;
*);;
esac
echo "Have changed to :"
. ~/.bashrc
go env | grep GOPROXY
echo "Please execute: source ~/.bashrc"
}
para=$1
setSources
echo -e "${GREEN}Done${PLAIN}"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
其他
1
https://gitee.com/ncnynl/commands.git
git@gitee.com:ncnynl/commands.git
ncnynl
commands
commands
master

搜索帮助