fusen-gateway/update_fspkg_master.sh

25 lines
903 B
Bash
Raw Normal View History

2023-11-07 03:16:29 +00:00
#! /bin/bash
input_string=$(cat go.mod)
# 使用sed命令提取参数并替换输出格式
output=$(echo "$input_string" | sed -nE 's/[[:space:]]{0,}(replace[[:space:]]+)?([[:alnum:]-]+)[[:space:]]+([[:alnum:].-]+)[[:space:]]+=>[[:space:]]+([[:alnum:]/.-]+)[[:space:]]+([[:alnum:].-]+)/\2 \3 \4 \5/p')
IFS=$'\n' # 设置分隔符为换行符
for out in $output; do
IFS=$' '
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
laster_master=`echo $(GOPROXY=direct go get $fsfullname@master 2>&1) | grep -oE '@v[^:"]+'`
echo "go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master"
go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master
done
IFS=$'\n' # 设置分隔符为换行符
for out in $output; do
IFS=$' '
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
go get $fsname@$fsversion
done
2023-11-10 10:36:43 +00:00
go mod tidy
2023-11-07 03:16:29 +00:00
go mod vendor