Skip to content

Commit

Permalink
fix: tip now require go1.22.6 to compile
Browse files Browse the repository at this point in the history
(note: prebuilt go tip binaries seem no longer available.)

Signed-off-by: Maxime Soulé <[email protected]>
  • Loading branch information
maxatome committed Aug 21, 2024
1 parent 07386de commit 26fb752
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ 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 }}

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
Expand All @@ -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
Expand Down
20 changes: 9 additions & 11 deletions install-go.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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}";

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 $/;
Expand All @@ -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)
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 26fb752

Please sign in to comment.