From d98c8638847edf4553ded36a0c269f2e9e617f12 Mon Sep 17 00:00:00 2001
From: Yevhen Pavlov <yevhen.pavlov.ua@gmail.com>
Date: Tue, 17 Oct 2023 13:24:54 +0300
Subject: [PATCH] actions/setup-go use go-version-file (#27651)

These changes will allow not to specify the version of go in every
pipeline.
---
 .github/workflows/cron-licenses.yml       |  2 +-
 .github/workflows/pull-compliance.yml     | 13 ++++++++-----
 .github/workflows/pull-db-tests.yml       | 10 +++++-----
 .github/workflows/pull-e2e-tests.yml      |  2 +-
 .github/workflows/release-nightly.yml     |  6 +++---
 .github/workflows/release-tag-rc.yml      |  2 +-
 .github/workflows/release-tag-version.yml |  2 +-
 7 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/cron-licenses.yml b/.github/workflows/cron-licenses.yml
index 5de165487c..0fbcbf603d 100644
--- a/.github/workflows/cron-licenses.yml
+++ b/.github/workflows/cron-licenses.yml
@@ -13,7 +13,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make generate-license generate-gitignore
         timeout-minutes: 40
diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml
index d19fa16024..bf9236b093 100644
--- a/.github/workflows/pull-compliance.yml
+++ b/.github/workflows/pull-compliance.yml
@@ -19,7 +19,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make deps-backend deps-tools
       - run: make lint-backend
@@ -72,7 +72,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make deps-backend deps-tools
       - run: make lint-go-windows lint-go-vet
@@ -89,7 +89,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make deps-backend deps-tools
       - run: make lint-go
@@ -104,7 +104,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make deps-backend deps-tools
       - run: make --always-make checks-backend # ensure the "go-licenses" make target runs
@@ -132,7 +132,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       # no frontend build here as backend should be able to build
       # even without any frontend files
@@ -176,4 +176,7 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
+        with:
+          go-version-file: go.mod
+          check-latest: true
       - run: make lint-actions
diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml
index 9fcdea44ee..97446e6cd3 100644
--- a/.github/workflows/pull-db-tests.yml
+++ b/.github/workflows/pull-db-tests.yml
@@ -41,7 +41,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - name: Add hosts to /etc/hosts
         run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
@@ -66,7 +66,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - run: make deps-backend
       - run: make backend
@@ -117,7 +117,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - name: Add hosts to /etc/hosts
         run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
@@ -167,7 +167,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - name: Add hosts to /etc/hosts
         run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
@@ -200,7 +200,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - name: Add hosts to /etc/hosts
         run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml
index 3fca2bee80..357ccb48be 100644
--- a/.github/workflows/pull-e2e-tests.yml
+++ b/.github/workflows/pull-e2e-tests.yml
@@ -19,7 +19,7 @@ jobs:
       - uses: actions/checkout@v4
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: actions/setup-node@v3
         with:
diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml
index cc2afca5dd..b70a65c070 100644
--- a/.github/workflows/release-nightly.yml
+++ b/.github/workflows/release-nightly.yml
@@ -20,7 +20,7 @@ jobs:
       - run: git fetch --unshallow --quiet --tags --force
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: actions/setup-node@v3
         with:
@@ -66,7 +66,7 @@ jobs:
       - run: git fetch --unshallow --quiet --tags --force
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: docker/setup-qemu-action@v2
       - uses: docker/setup-buildx-action@v2
@@ -103,7 +103,7 @@ jobs:
       - run: git fetch --unshallow --quiet --tags --force
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: docker/setup-qemu-action@v2
       - uses: docker/setup-buildx-action@v2
diff --git a/.github/workflows/release-tag-rc.yml b/.github/workflows/release-tag-rc.yml
index 9019fc9a3a..06b21db4db 100644
--- a/.github/workflows/release-tag-rc.yml
+++ b/.github/workflows/release-tag-rc.yml
@@ -19,7 +19,7 @@ jobs:
       - run: git fetch --unshallow --quiet --tags --force
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: actions/setup-node@v3
         with:
diff --git a/.github/workflows/release-tag-version.yml b/.github/workflows/release-tag-version.yml
index c643166666..f85f002894 100644
--- a/.github/workflows/release-tag-version.yml
+++ b/.github/workflows/release-tag-version.yml
@@ -21,7 +21,7 @@ jobs:
       - run: git fetch --unshallow --quiet --tags --force
       - uses: actions/setup-go@v4
         with:
-          go-version: "~1.21"
+          go-version-file: go.mod
           check-latest: true
       - uses: actions/setup-node@v3
         with: