From 26fb7529dfecf3b3e80323af2d207a8c2bdb0e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Soul=C3=A9?= Date: Wed, 21 Aug 2024 23:03:14 +0200 Subject: [PATCH] fix: tip now require go1.22.6 to compile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (note: prebuilt go tip binaries seem no longer available.) Signed-off-by: Maxime Soulé --- README.md | 8 ++++---- install-go.pl | 20 +++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d82ac29..85225a3 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ jobs: test: strategy: matrix: - go-version: [1.9.x, 1.10.x, 1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, tip] + go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, tip] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} @@ -60,7 +60,7 @@ jobs: steps: - name: Setup go run: | - curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.5/install-go.pl | + curl -sL https://raw.githubusercontent.com/maxatome/install-go/v3.6/install-go.pl | perl - ${{ matrix.go-version }} $HOME/go - name: Checkout code @@ -74,10 +74,10 @@ jobs: ``` -### Install last version of go 1.16 in current directory: +### Install last version of go 1.22 in current directory: ``` -./install-go.pl 1.16.x +./install-go.pl 1.22.x ``` then diff --git a/install-go.pl b/install-go.pl index a8c75ba..789fa9d 100755 --- a/install-go.pl +++ b/install-go.pl @@ -87,15 +87,15 @@ $goroot = go_env('go', 'GOROOT'); } - # If go is already installed somewhere *and* ≥ 1.18, no need to install it - if ($goroot and go_version("$goroot/bin/go") ge v1.18) + # If go is already installed somewhere *and* ≥ 1.22.6, no need to install it + if ($goroot and go_version("$goroot/bin/go") ge v1.22.6) { my $goroot_tip = install_tip($goroot, $DESTDIR); export_env("$DESTDIR/go", $goroot_tip); exit 0; } - $TARGET = '1.20.x'; + $TARGET = '1.22.x'; $TIP = 1; } @@ -245,8 +245,8 @@ sub get_url my $full = $target; $full .= ".$last_minor" if defined $last_minor; - say "Check https://golang.org/dl/go$full.$OS-$ARCH.$EXT"; - my $r = http_head("https://golang.org/dl/go$full.$OS-$ARCH.$EXT"); + say "Check https://go.dev/dl/go$full.$OS-$ARCH.$EXT"; + my $r = http_head("https://go.dev/dl/go$full.$OS-$ARCH.$EXT"); return ($r->{url}, $full) if $r->{success}; say "=> $r->{status}"; @@ -402,7 +402,7 @@ sub get_builder_type return; } - foreach my $key("$OS-$ARCH", ($ARCH eq 'amd64' ? $OS : ())) + foreach my $key ("$OS-$ARCH", ($ARCH eq 'amd64' ? $OS : ())) { # "darwin": "darwin-amd64-10_14", # "darwin-amd64": "darwin-amd64-10_14", @@ -523,7 +523,7 @@ sub http_get { local $/ = "\r\n\r\n"; <$fh> } # Redirect -> new header - last if $r{status} != 302 and $r{status} != 307; + last if $r{status} != 301 and $r{status} != 302 and $r{status} != 307; } local $/; @@ -533,9 +533,7 @@ sub http_get } my $r = HTTP::Tiny::->new->get($url); - if (not $r->{success} - and $r->{status} == 599 - and $r->{content} =~ /must be installed for https support/) + if (not $r->{success} and $r->{status} == 599) { $use_curl = 1; return http_get($url) @@ -569,7 +567,7 @@ sub http_head $r{success} = $r{status} < 400; # Redirect -> new header - last if $r{status} != 302 and $r{status} != 307; + last if $r{status} != 301 and $r{status} != 302 and $r{status} != 307; # Consume headers and catch location header local $/ = "\r\n\r\n";