From ccce66966b89f054e9dc02a8e1f70f6d57148125 Mon Sep 17 00:00:00 2001
From: wwqgtxx <wwqgtxx@gmail.com>
Date: Fri, 24 May 2024 11:30:02 +0800
Subject: [PATCH] add update-go-mod-replace

---
 .github/workflows/build-debug.yaml         | 2 +-
 .github/workflows/build-release.yaml       | 2 +-
 .github/workflows/update-dependencies.yaml | 8 +++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/build-debug.yaml b/.github/workflows/build-debug.yaml
index 76f9733299..9f8e46f9b0 100644
--- a/.github/workflows/build-debug.yaml
+++ b/.github/workflows/build-debug.yaml
@@ -23,7 +23,7 @@ jobs:
       - name: Setup Go
         uses: actions/setup-go@v5
         with:
-          go-version: "1.20"
+          go-version: "1.22"
 
       - uses: actions/cache@v4
         with:
diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml
index 1d81a8a89d..75389ee611 100644
--- a/.github/workflows/build-release.yaml
+++ b/.github/workflows/build-release.yaml
@@ -28,7 +28,7 @@ jobs:
       - name: Setup Go
         uses: actions/setup-go@v5
         with:
-          go-version: "1.20"
+          go-version: "1.22"
 
       - uses: actions/cache@v4
         with:
diff --git a/.github/workflows/update-dependencies.yaml b/.github/workflows/update-dependencies.yaml
index 9ea637af2c..d0a266f8b5 100644
--- a/.github/workflows/update-dependencies.yaml
+++ b/.github/workflows/update-dependencies.yaml
@@ -24,7 +24,7 @@ jobs:
       - name: Setup Go
         uses: actions/setup-go@v5
         with:
-          go-version: "1.20"
+          go-version: "1.22"
       
       - uses: actions/cache@v4
         with:
@@ -39,14 +39,20 @@ jobs:
         run: |
           ./gradlew :core:downloadGeoipDatabase
 
+      - name: Install update-go-mod-replace
+        run: |
+          go install github.com/metacubex/update-go-mod-replace@latest
+
       - name: Update Foss Gomod
         run: |
           cd ${{ github.workspace }}/core/src/foss/golang/
+          update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
           go mod tidy
 
       - name: Update Main Gomod
         run: |
           cd ${{ github.workspace }}/core/src/main/golang/native/
+          update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
           go mod tidy
 
       - uses: tibdex/github-app-token@v2