From 34bd55872bd5f5e92613f6070bfc1c561298bbb2 Mon Sep 17 00:00:00 2001
From: Shubham Chaudhary <shubham.chaudhary@harness.io>
Date: Sat, 1 Jun 2024 13:02:29 +0530
Subject: [PATCH] chore(go): upgrade the go version

Signed-off-by: Shubham Chaudhary <shubham.chaudhary@harness.io>
---
 .github/workflows/build.yml   | 18 ++++++------
 .github/workflows/e2e.yml     | 52 +++++++++++++++++------------------
 .github/workflows/push.yml    |  6 ++--
 .github/workflows/release.yml |  6 ++--
 go.mod                        |  2 +-
 5 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 70d10b6f..dfd40be9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,7 +11,7 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       # Checkout to the latest commit
       # On specific directory/path
@@ -26,7 +26,7 @@ jobs:
 
       - name: unused-package check
         run: make unused-package-check
-        
+
   trivy:
     needs: pre-checks
     runs-on: ubuntu-latest
@@ -38,7 +38,7 @@ jobs:
       - name: Build an image from Dockerfile
         run: |
           docker build -f build/Dockerfile -t docker.io/litmuschaos/chaos-operator:${{ github.sha }} . --build-arg TARGETPLATFORM=linux/amd64
-      
+
       - name: Run Trivy vulnerability scanner
         uses: aquasecurity/trivy-action@master
         with:
@@ -47,7 +47,7 @@ jobs:
           exit-code: '1'
           ignore-unfixed: true
           vuln-type: 'os,library'
-          severity: 'CRITICAL,HIGH'        
+          severity: 'CRITICAL,HIGH'
 
   gitleaks-scan:
     runs-on: ubuntu-latest
@@ -79,7 +79,7 @@ jobs:
           make build-amd64
           docker save -o ${{ github.workspace }}/image.tar litmuschaos/chaos-operator:ci
           chmod +x ${{ github.workspace }}/image.tar
-      
+
       - name: Upload artifact
         uses: actions/upload-artifact@v2
         with:
@@ -94,7 +94,7 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       # Checkout to the latest commit
       # On specific directory/path
@@ -103,7 +103,7 @@ jobs:
 
       #Install and configure a kind cluster
       - name: Installing Prerequisites (K3S Cluster)
-        env: 
+        env:
           KUBECONFIG: /etc/rancher/k3s/k3s.yaml
         run: |
           curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.14-rc1+k3s1 sh -s - --docker --write-kubeconfig-mode 664
@@ -121,11 +121,11 @@ jobs:
         with:
           name: myimage
           path: ${{ github.workspace }}
-          
+
       - name: Load Docker image
         run: |
           docker load --input ${{ github.workspace }}/image.tar
-        shell: bash      
+        shell: bash
 
       - name: Running Go BDD Test
         run: |
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 68a0143c..ed55ca5d 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -2,13 +2,13 @@ name: ChaosOperator-E2E-pipeline
 on:
   issue_comment:
     types: [created]
- 
+
 jobs:
   Tests:
     if: contains(github.event.comment.html_url, '/pull/') && startsWith(github.event.comment.body, '/run-e2e')
     runs-on: ubuntu-latest
     steps:
- 
+
       - name: Notification for e2e Start
         uses: peter-evans/create-or-update-comment@v1
         with:
@@ -19,13 +19,13 @@ jobs:
 
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
- 
-      - name: Setting up GOPATH 
+          go-version: 1.22
+
+      - name: Setting up GOPATH
         run: |
           echo ::set-env name=GOPATH::${GITHUB_WORKSPACE}/go
         env:
-          ACTIONS_ALLOW_UNSECURE_COMMANDS: true          
+          ACTIONS_ALLOW_UNSECURE_COMMANDS: true
 
       #Using the last commit id of pull request
       - uses: octokit/request-action@v2.x
@@ -36,20 +36,20 @@ jobs:
           pull_number: ${{ github.event.issue.number }}
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 
+
       - name: set commit to output
         id: getcommit
         run: | 
            prsha=$(echo $response | jq '.[-1].sha'  | tr -d '"')
-           echo "::set-output name=sha::$prsha" 
-        env: 
+           echo "::set-output name=sha::$prsha"
+        env:
           response:  ${{ steps.get_PR_commits.outputs.data }}
-          
+
       - uses: actions/checkout@v2
         with:
           ref: ${{steps.getcommit.outputs.sha}}
           path: go/src/github.com/litmuschaos/chaos-operator
-          
+
       - name: Build docker image
         run: |
           export PATH=$PATH:$(go env GOPATH)/bin
@@ -62,7 +62,7 @@ jobs:
         uses: engineerd/setup-kind@v0.5.0
         with:
             version: "v0.22.0"
- 
+
       - name: Configuring and testing kind Installation
         run: |
           kubectl cluster-info
@@ -88,8 +88,8 @@ jobs:
         env:
           OPERATOR_IMAGE: litmuschaos/chaos-operator:ci
           IMAGE_PULL_POLICY: IfNotPresent
-          KUBECONFIG: /home/runner/.kube/config 
- 
+          KUBECONFIG: /home/runner/.kube/config
+
       - name: Run Admin mode test
         if: startsWith(github.event.comment.body, '/run-e2e-admin-mode') || startsWith(github.event.comment.body, '/run-e2e-all')
         run: |
@@ -97,7 +97,7 @@ jobs:
           cd ${GOPATH}/src/github.com/litmuschaos/litmus-e2e
           go test components/operator/admin-mode_test.go -v -count=1
         env:
-          KUBECONFIG: /home/runner/.kube/config           
+          KUBECONFIG: /home/runner/.kube/config
 
       - name: Run Reconcile Resiliency test
         if: startsWith(github.event.comment.body, '/run-e2e-reconcile-resiliency') || startsWith(github.event.comment.body, '/run-e2e-all')
@@ -106,7 +106,7 @@ jobs:
           cd ${GOPATH}/src/github.com/litmuschaos/litmus-e2e
           go test components/operator/reconcile-resiliency_test.go -v -count=1
         env:
-          KUBECONFIG: /home/runner/.kube/config           
+          KUBECONFIG: /home/runner/.kube/config
 
       - name: Check the test run
         if: |
@@ -115,7 +115,7 @@ jobs:
         run: |
           echo ::set-env name=TEST_RUN::true
         env:
-          ACTIONS_ALLOW_UNSECURE_COMMANDS: true          
+          ACTIONS_ALLOW_UNSECURE_COMMANDS: true
 
       - name: Check for all the jobs are succeeded
         if: ${{ success() && env.TEST_RUN == 'true' }}
@@ -125,11 +125,11 @@ jobs:
           body: |  
             **Test Result:** All tests are passed
             **Logs:** [${{ env.RUN_ID }}](https://github.com/litmuschaos/chaos-operator/actions/runs/${{ env.RUN_ID }})                        
-           
-          reactions: hooray         
-        env: 
+
+          reactions: hooray
+        env:
           RUN_ID: ${{ github.run_id }}
- 
+
       - name: Check for any job failed
         if: ${{ failure() }}
         uses: peter-evans/create-or-update-comment@v1
@@ -137,15 +137,15 @@ jobs:
           comment-id: "${{ github.event.comment.id }}"
           body: |
             **Test Failed:** Some tests are failed please check
-            **Logs:** [${{ env.RUN_ID }}](https://github.com/litmuschaos/chaos-operator/actions/runs/${{ env.RUN_ID }})            
+            **Logs:** [${{ env.RUN_ID }}](https://github.com/litmuschaos/chaos-operator/actions/runs/${{ env.RUN_ID }})
           reactions: confused
-        env: 
+        env:
           RUN_ID: ${{ github.run_id }}
- 
+
       - name: Deleting KinD cluster
         if: ${{ always() }}
         run: kind delete cluster
- 
+
       - name: Check if any test ran or not
         if: env.TEST_RUN != 'true'
         uses: peter-evans/create-or-update-comment@v1
@@ -155,5 +155,5 @@ jobs:
             **Test Result:** No test found try /run-e2e-all
             **Logs:** [${{ env.RUN_ID }}](https://github.com/litmuschaos/chaos-operator/actions/runs/${{ env.RUN_ID }})
           reactions: eyes
-        env: 
+        env:
           RUN_ID: ${{ github.run_id }}
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 626ac8de..8aba7197 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -13,7 +13,7 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       # Checkout to the latest commit
       # On specific directory/path
@@ -73,11 +73,11 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       #Install and configure a kind cluster
       - name: Installing Prerequisites (K3S Cluster)
-        env: 
+        env:
           KUBECONFIG: /etc/rancher/k3s/k3s.yaml
         run: |
           curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.14-rc1+k3s1 sh -s - --docker --write-kubeconfig-mode 664
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index be320ce1..b1333d6f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,7 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       # Checkout to the latest commit
       # On specific directory/path
@@ -86,11 +86,11 @@ jobs:
       # Install golang
       - uses: actions/setup-go@v2
         with:
-          go-version: 1.20.0
+          go-version: 1.22
 
       #Install and configure a kind cluster
       - name: Installing Prerequisites (K3S Cluster)
-        env: 
+        env:
           KUBECONFIG: /etc/rancher/k3s/k3s.yaml
         run: |
           curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.20.14-rc1+k3s1 sh -s - --docker --write-kubeconfig-mode 664
diff --git a/go.mod b/go.mod
index cff37877..91f034bd 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/litmuschaos/chaos-operator
 
-go 1.20
+go 1.22
 
 require (
 	cloud.google.com/go v0.81.0 // indirect