File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,23 @@ jobs:
2828 restore-keys : |
2929 ${{ runner.os }}-go-
3030
31+ - name : Clean module cache
32+ run : go clean -modcache
33+
3134 - name : Download dependencies
3235 run : go mod download
3336
37+ - name : Verify dependencies and update go.sum
38+ run : |
39+ go mod tidy
40+ go mod verify || true
41+ # 如果verify失败,继续构建,因为可能是CI环境中的临时问题
42+
3443 - name : Run tests
3544 run : go test -v ./...
3645
3746 - name : Build
38- run : go build -v .
47+ run : go build -mod=readonly - v .
3948
4049 - name : Run go vet
4150 run : go vet ./...
Original file line number Diff line number Diff line change 6262 restore-keys : |
6363 ${{ runner.os }}-go-
6464
65+ - name : Clean module cache
66+ run : go clean -modcache
67+
6568 - name : Download dependencies
6669 run : go mod download
6770
71+ - name : Verify dependencies and update go.sum
72+ run : |
73+ go mod tidy
74+ go mod verify || true
75+ # 如果verify失败,继续构建,因为可能是CI环境中的临时问题
76+
6877 - name : Build
6978 env :
7079 GOOS : ${{ matrix.goos }}
7483 run : |
7584 mkdir -p dist
7685 output_name="${{ matrix.filename }}"
77- go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o "dist/${output_name}" .
86+ # 确保在构建前重新同步依赖
87+ go mod download
88+ go build -mod=readonly -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o "dist/${output_name}" .
7889
7990 - name : Create archive
8091 run : |
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ echo ⏰ 构建时间: %BUILD_TIME%
2727echo 🔧 Git提交: %GIT_COMMIT%
2828echo .
2929
30+ echo 📥 检查和更新依赖...
31+ go mod tidy
32+ go mod verify
33+
34+ echo .
3035REM 开始构建
3136call :build linux amd64 " " webhookGo-linux-amd64
3237call :build linux arm64 " " webhookGo-linux-arm64
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ platforms=(
3636 " freebsd/amd64"
3737)
3838
39+ # 确保依赖正确
40+ echo " 📥 检查和更新依赖..."
41+ go mod tidy
42+ go mod verify
43+
3944# 开始构建
4045for platform in " ${platforms[@]} " ; do
4146 IFS=' /' read -r goos goarch goarm <<< " $platform"
You can’t perform that action at this time.
0 commit comments