diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 902e82cf1..57c498272 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,7 +34,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.22.x" + go-version: "1.24.x" - name: Go Format run: gofmt -s -w . && git diff --exit-code diff --git a/.github/workflows/integration_tests.yaml b/.github/workflows/integration_tests.yaml index 44112e7f0..a0eceea54 100644 --- a/.github/workflows/integration_tests.yaml +++ b/.github/workflows/integration_tests.yaml @@ -32,7 +32,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: "1.22.x" + go-version: "1.24.x" - name: Set up Python uses: actions/setup-python@v5 diff --git a/data/ansible/roles/go/defaults/main.yaml b/data/ansible/roles/go/defaults/main.yaml index 0248bd24c..b999bb5be 100644 --- a/data/ansible/roles/go/defaults/main.yaml +++ b/data/ansible/roles/go/defaults/main.yaml @@ -1,8 +1,12 @@ --- -go_version: 1.23.1 +go_version: 1.24.0 go_platform: linux go_arch: amd64 go_tarball: go{{ go_version }}.{{ go_platform }}-{{ go_arch }}.tar.gz go_download_url: https://dl.google.com/go/{{ go_tarball }} -go_checksum: 49bbb517cfa9eee677e1e7897f7cf9cfdbcf49e05f61984a2789136de359f9bd +go_checksum: dea9ca38a0b852a74e81c26134671af7c0fbe65d81b0dc1c5bfe22cf7d4c8858 install_go: true + +# Cleaning caches assumes go is available (either installed by the role or pre-existing) +go_clean_modcache: false +go_clean_build_cache: false diff --git a/data/ansible/roles/go/tasks/main.yaml b/data/ansible/roles/go/tasks/main.yaml index 0e50e1835..1dd6dc483 100644 --- a/data/ansible/roles/go/tasks/main.yaml +++ b/data/ansible/roles/go/tasks/main.yaml @@ -1,13 +1,13 @@ --- - name: Check if Go is already installed. - command: /usr/local/go/bin/go version + ansible.builtin.command: /usr/local/go/bin/go version ignore_errors: true register: go_version_result changed_when: false - name: Remove current installation. become: true - file: + ansible.builtin.file: state: absent path: /usr/local/go when: @@ -17,28 +17,54 @@ - name: Download Go. become: true - get_url: - url: '{{ go_download_url }}' - dest: /usr/local/src/{{ go_tarball }} - checksum: 'sha256:{{ go_checksum }}' + ansible.builtin.get_url: + url: "{{ go_download_url }}" + dest: "/usr/local/src/{{ go_tarball }}" + checksum: "sha256:{{ go_checksum }}" + mode: "0644" when: - install_go | bool - (go_version_result is failed or go_version not in go_version_result.stdout) - name: Extract Go. become: true - unarchive: - src: /usr/local/src/{{ go_tarball }} + ansible.builtin.unarchive: + src: "/usr/local/src/{{ go_tarball }}" dest: /usr/local - copy: no + copy: false when: - install_go | bool - (go_version_result is failed or go_version not in go_version_result.stdout) - name: Add Go to to system-wide $PATH. become: true - copy: + ansible.builtin.copy: dest: /etc/profile.d/go-path.sh content: |- export PATH=$PATH:/usr/local/go/bin + mode: "0644" when: install_go | bool + +- name: Get Go modcache path + ansible.builtin.command: go env GOMODCACHE + environment: + PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" + register: gomodcache_path + changed_when: false + when: go_clean_modcache + +# Using file module since go clean --modcache is just a wrapper for rm -rf $GOMODCACHE +- name: Clean Go modcache + become: true + ansible.builtin.file: + path: "{{ gomodcache_path.stdout }}" + state: absent + when: go_clean_modcache + +- name: Clean Go build cache + ansible.builtin.command: go clean -x --cache + environment: + PATH: "{{ ansible_env.PATH }}:/usr/local/go/bin" + register: cache_clean_result + when: go_clean_build_cache + changed_when: "'rm -rf' in cache_clean_result.stdout" diff --git a/data/docker/integration/Dockerfile b/data/docker/integration/Dockerfile index 5f3c5a9b6..501e79410 100644 --- a/data/docker/integration/Dockerfile +++ b/data/docker/integration/Dockerfile @@ -76,7 +76,7 @@ RUN apt-get clean && \ RUN touch /logs/mariadb.log /logs/mariadb_script.log /logs/rabbitmq.log RUN chmod 777 /logs/mariadb.log /logs/mariadb_script.log /logs/rabbitmq.log -RUN wget -O go.tgz "https://storage.googleapis.com/golang/go1.23.1.linux-amd64.tar.gz" --progress=dot:giga +RUN wget -O go.tgz "https://storage.googleapis.com/golang/go1.24.0.linux-amd64.tar.gz" --progress=dot:giga RUN tar -C /usr/local -xzf go.tgz RUN rm go.tgz diff --git a/docs/installation.rst b/docs/installation.rst index 82d22b17d..d1f38fb52 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -142,8 +142,8 @@ To install the latest Go version at the time of writing this documentation, run: # sudo dnf install -y wget tar for .rpm distros sudo rm -rf /usr/local/go cd /tmp - wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz + wget https://go.dev/dl/go1.24.0.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin Installation diff --git a/go.mod b/go.mod index ae6f5fa5c..72fb67fb7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cgrates/cgrates -go 1.23.1 +go 1.24.0 // replace github.com/cgrates/radigo => /home/dan/go/src/github.com/cgrates/radigo // replace github.com/cgrates/rpcclient => ../rpcclient diff --git a/packages/copr.fedorainfracloud.org/cgrates.spec b/packages/copr.fedorainfracloud.org/cgrates.spec index 170b5a4bf..84791801f 100644 --- a/packages/copr.fedorainfracloud.org/cgrates.spec +++ b/packages/copr.fedorainfracloud.org/cgrates.spec @@ -1,6 +1,6 @@ # Define global variables %global version 0.10.4 -%global go_version 1.23.1 +%global go_version 1.24.0 # Define system paths %global _logdir /var/log/%name diff --git a/packages/redhat_fedora/cgrates.spec b/packages/redhat_fedora/cgrates.spec index 4837f843a..4cced189f 100644 --- a/packages/redhat_fedora/cgrates.spec +++ b/packages/redhat_fedora/cgrates.spec @@ -2,7 +2,7 @@ %global version 0.10.4 %global git_commit %(echo $gitLastCommit) %global releaseTag %(echo $rpmTag) -%global go_version 1.23.1 +%global go_version 1.24.0 # Define system paths %global _logdir /var/log/%name