mochengqian commented on code in PR #1477:
URL: https://github.com/apache/dubbo-admin/pull/1477#discussion_r3446823938


##########
.github/workflows/ci.yml:
##########
@@ -69,21 +69,9 @@ jobs:
         uses: actions/setup-go@v5
         with:
           go-version-file: go.mod
-      - name: Cache dependencies
-        # ref: 
https://github.com/actions/cache/blob/main/examples.md#go---module
-        uses: actions/cache@v4
-        with:
-          # Cache, works only on Linux
-          path: |
-            ~/.cache/go-build
-            ~/go/pkg/mod
-          # Cache key
-          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
-          # An ordered list of keys to use for restoring the cache if no cache 
hit occurred for key
-          restore-keys: |
-            ${{ runner.os }}-go-
+          cache-dependency-path: go.sum
       - name: Check Code Format
-        run: make fmt && git status && [[ -z `git status -s` ]]
+        run: make fmt && git status && [[ -z $(git status -s) ]]

Review Comment:
   此项工作流变更的原因是,PR CI 在可靠运行 Go 测试之前就已失败(CI failure 有明确日志证据)。
   
   失败的 GitHub Actions 任务显示了手动 Go 模块缓存恢复时出现的 tar 恢复错误,包括:
   
     Failed to restore: "/usr/bin/tar" failed
     Cannot open: File exists
   
   该冲突源于缓存了整个 `~/go/pkg/mod` 目录,而 Go 1.24/工具链管理机制以及 `actions/setup-go` 
本身已会在模块缓存下填充由工具链管理的文件。在已存在工具链文件的情况下恢复该缓存,导致 Go 1.24 矩阵任务失败。
   
   本次修复移除了针对 Go 模块的冗余手动 `actions/cache` 步骤,改为由 `actions/setup-go@v5` 以 `go.sum` 
作为依赖键来处理 Go 缓存。构建或测试命令本身未作更改:工作流仍然执行相同的前端构建、`make fmt check` 和 `make test`。
   
   变更后,两个 Go CI 矩阵任务均通过:
   - CI(ubuntu-latest - Go 1.24):成功
   - CI(ubuntu-latest - Go 1.23):成功



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to