Skip to content

Commit f49cd37

Browse files
authored
Improve windows support
It seems the unzip binary that comes with Git for Windows is slightly different from unzip on Linux and macOS. While I was using this `windows-latest`, this script would cause unzip to _only_ extract the files that are directly in the `go/pkg` and `go/src` dirs causing the sources of all built-in packages to be unavailable. This changes the call to recursively extract the files for those two dirs. In addition `MSWin32` was added to the test for downloading the win binaries. This allows for the script to be run directly from PowerShell, at least on GitHub actions. It'll likely work everywhere as long as the curl/unzip (and other dependency) binaries are available in the PATH.
1 parent 09d6a58 commit f49cd37

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

install-go.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
my($ARCH, $EXT) = ('amd64', 'tar.gz');
5656
my $OS;
5757
if ($^O eq 'linux' or $^O eq 'freebsd' or $^O eq 'darwin') { $OS = $^O }
58-
elsif ($^O eq 'msys' or $^O eq 'cygwin')
58+
elsif ($^O eq 'msys' or $^O eq 'cygwin' or $^O eq 'MSWin32')
5959
{
6060
$OS = 'windows';
6161
$EXT = 'zip';
@@ -233,7 +233,7 @@ sub install_go
233233
if ($EXT eq 'zip')
234234
{
235235
exe(qw(curl -L -s -o x.zip), $url);
236-
exe(qw(unzip x.zip go/bin/* go/pkg/* go/src/*));
236+
exe(qw(unzip x.zip go/bin/* go/pkg/**/* go/src/**/*));
237237
unlink 'x.zip';
238238
}
239239
else

0 commit comments

Comments
 (0)