1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-go synced 2025-06-08 19:48:21 +02:00

Export GOROOT for versions < 1.9

This commit is contained in:
Josh Gross 2022-03-14 12:21:30 -04:00
parent 83124a14b6
commit 2a34c33bd7
No known key found for this signature in database
GPG key ID: 17A6308EA2144978
3 changed files with 56 additions and 20 deletions

View file

@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as installer from './installer';
import * as semver from 'semver';
import path from 'path';
import cp from 'child_process';
import fs from 'fs';
@ -26,6 +27,13 @@ export async function run() {
core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');
const version = installer.makeSemver(versionSpec);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info("Setting GOROOT for Go version < 1.9");
core.exportVariable('GOROOT', installDir);
}
let added = await addBinToPath();
core.debug(`add bin ${added}`);
core.info(`Successfully setup go version ${versionSpec}`);