添加 update_fspkg_master.tpl
This commit is contained in:
parent
33a489ab93
commit
d153a6544b
|
@ -1,25 +1,38 @@
|
||||||
#! /bin/bash
|
#! /bin/env bash
|
||||||
|
|
||||||
input_string=$(cat go.mod)
|
input_string=$(cat go.mod)
|
||||||
|
|
||||||
# 使用sed命令提取参数并替换输出格式
|
# 使用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')
|
output=$(echo "$input_string" | sed -nE 's/[[:space:]]{0,}(replace[[:space:]]+)?([[:alnum:]-]+)[[:space:]]+([[:alnum:].-]+)[[:space:]]+=>[[:space:]]+([[:alnum:]/.-]+)[[:space:]]+([[:alnum:].-]+)/\2 \3 \4 \5/p')
|
||||||
|
|
||||||
|
# echo $output
|
||||||
|
ischange="no"
|
||||||
|
|
||||||
IFS=$'\n' # 设置分隔符为换行符
|
IFS=$'\n' # 设置分隔符为换行符
|
||||||
for out in $output; do
|
for out in $output; do
|
||||||
IFS=$' '
|
IFS=$' '
|
||||||
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
|
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
|
||||||
|
if [ "$fsname" != "fusen-basic" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
laster_master=`echo $(GOPROXY=direct go get $fsfullname@master 2>&1) | grep -oE '@v[^:"]+'`
|
laster_master=`echo $(GOPROXY=direct go get $fsfullname@master 2>&1) | grep -oE '@v[^:"]+'`
|
||||||
|
if [ "@$fslatest_master" == "$laster_master" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
echo "go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master"
|
echo "go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master"
|
||||||
go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master
|
go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master
|
||||||
done
|
echo "当前 $fsname $fsfullname $fslatest_master (更新)-> $laster_master"
|
||||||
|
|
||||||
IFS=$'\n' # 设置分隔符为换行符
|
|
||||||
for out in $output; do
|
|
||||||
IFS=$' '
|
|
||||||
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
|
|
||||||
go get $fsname@$fsversion
|
go get $fsname@$fsversion
|
||||||
|
ischange="yes"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$ischange" == "yes" ]; then
|
||||||
|
echo "go tidy and vendor"
|
||||||
go mod tidy
|
go mod tidy
|
||||||
go mod vendor
|
go mod vendor
|
||||||
|
else
|
||||||
|
echo "$fsname $fslatest_master 当前最新"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user