Merge "Put cronjobs in order"
[infra/cicd.git] / jjb / oransc / verify-jobs-go.sh
index 10f809cb5b8122df15340b1c911c4024c3df5a5e..84b3f5a090a64a53a512a5a373c7f9d3ce26d558 100644 (file)
@@ -2,29 +2,19 @@
 
 set -euo pipefail
 
-DIRECTORY = $WORKSPACE"/"$DIRECTORY
+DIRECTORY=$WORKSPACE"/"${DIRECTORY}
 cd $DIRECTORY
 
 # Read desired Go version from go.mod file
 desired_version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+')
 
-# Check installed Go version
-installed_version=$(go version | awk '{print $3}' | sed 's/go//')
+# Remove existing Go installation
+sudo rm -fr /usr/local/go
 
-if [ "$desired_version" != "$installed_version" ]; then
-    echo "Desired Go version: $desired_version"
-    echo "Installed Go version: $installed_version"
+echo "Download go $desired_version"
+curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf -
 
-    # Remove existing Go installation
-    sudo rm -fr /usr/local/go
-
-    echo "Download go $desired_version"
-    curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf -
-
-    export PATH=$PATH:/usr/local/go/bin
-else
-    echo "Go version is up to date: $desired_version"
-fi
+export PATH=$PATH:/usr/local/go/bin
 
 echo "Download project deps"
 go mod tidy