mirror of
https://github.com/actions/setup-go.git
synced 2025-05-04 14:14:34 +00:00
Export GOROOT
for versions < 1.9
This commit is contained in:
@ -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}`);
|
||||
|
Reference in New Issue
Block a user