Skip to content

Commit 77c2634

Browse files
committed
fix set go env in windows
Signed-off-by: Kay Yan <[email protected]>
1 parent 74f2755 commit 77c2634

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/test-canary.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,37 @@ jobs:
6464
<(sed -E 's/^go([0-9]+)[.]([0-9]+)([.]([0-9]+))?(([a-z]+)([0-9]+))?/\1.\2\n\4\n\6\n\7/i' \
6565
<(curl -fsSL "https://go.dev/dl/?mode=json&include=all" | jq -rc .[0].version) \
6666
)
67-
67+
echo "${norm[0]}"
68+
echo "${norm[1]}"
69+
echo "${norm[2]}"
70+
echo "${norm[3]}"
6871
# Serialize version, making sure we have a patch version, and separate possible rcX into .rc-X
6972
[ "${norm[1]}" != "" ] || norm[1]="0"
7073
norm[1]=".${norm[1]}"
7174
[ "${norm[2]}" == "" ] || norm[2]="-${norm[2]}"
72-
[ "${norm[3]}" == "" ] || norm[3]=".${norm[3]}"
75+
if [ -n "${norm[3]}" ]; then
76+
echo "norm3 meet"
77+
length=${#norm[3]}
78+
echo "Character length $length"
79+
for ((i = 0; i < length; i++)); do
80+
char="${norm[3]:i:1}"
81+
echo "Character at position $i: $char"
82+
ascii_value=$(printf "%d" "'$char")
83+
echo "ASCII value of $char: $ascii_value"
84+
done
85+
norm[3]="${norm[3]//+([[:space:]])/}" # 移除所有空白字符
86+
87+
[ "${norm[3]}" == "" ] || norm[3]=".${norm[3]}"
88+
fi
7389
# Save it
7490
IFS=
7591
echo "GO_VERSION=${norm[*]}" >> $GITHUB_ENV
92+
echo "${norm[0]}"
93+
echo "${norm[1]}"
94+
echo "${norm[2]}"
95+
echo "${norm[3]}"
96+
echo "${norm[*]}"
97+
7698
- uses: actions/[email protected]
7799
with:
78100
fetch-depth: 1

0 commit comments

Comments
 (0)