This commit is contained in:
Bryan MacFarlane 2020-02-09 08:44:32 -05:00
parent dc575ee3b3
commit 3c844703e7
5 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
name: 'Setup Go environment' name: 'Setup Go environment'
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support' description: 'Setup a Go environment and add it to the PATH'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
go-version: go-version:

7
dist/index.js vendored
View File

@ -1287,7 +1287,9 @@ function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted. // If not supplied then problem matchers will still be setup. Useful for self-hosted.
// //
let versionSpec = core.getInput('go-version'); let versionSpec = core.getInput('go-version');
let stable = (core.getInput('stable') || '').toUpperCase() == 'TRUE'; // stable will be true unless false is the exact input
// since getting unstable versions should be explicit
let stable = Boolean(core.getInput('stable') || 'true');
if (versionSpec) { if (versionSpec) {
let installDir = tc.find('go', versionSpec); let installDir = tc.find('go', versionSpec);
if (!installDir) { if (!installDir) {
@ -4588,7 +4590,7 @@ function downloadGo(versionSpec, stable) {
let match = yield findMatch(versionSpec, stable); let match = yield findMatch(versionSpec, stable);
if (match) { if (match) {
// download // download
let downloadUrl = `https://storage.googleapis.com/golang/${match.files[0]}`; let downloadUrl = `https://storage.googleapis.com/golang/${match.files[0].filename}`;
let downloadPath = yield tc.downloadTool(downloadUrl); let downloadPath = yield tc.downloadTool(downloadUrl);
// extract // extract
let extPath = sys.getPlatform() == 'windows' let extPath = sys.getPlatform() == 'windows'
@ -4628,7 +4630,6 @@ function findMatch(versionSpec, stable) {
if (parts.length == 2) { if (parts.length == 2) {
version = version + '.0'; version = version + '.0';
} }
//console.log(version, versionSpec);
if (semver.satisfies(version, versionSpec) && candidate.stable == stable) { if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
goFile = candidate.files.find(file => { goFile = candidate.files.find(file => {
return file.arch === archFilter && file.os === platFilter; return file.arch === archFilter && file.os === platFilter;

View File

@ -27,7 +27,7 @@ function downloadGo(versionSpec, stable) {
let match = yield findMatch(versionSpec, stable); let match = yield findMatch(versionSpec, stable);
if (match) { if (match) {
// download // download
let downloadUrl = `https://storage.googleapis.com/golang/${match.files[0]}`; let downloadUrl = `https://storage.googleapis.com/golang/${match.files[0].filename}`;
let downloadPath = yield tc.downloadTool(downloadUrl); let downloadPath = yield tc.downloadTool(downloadUrl);
// extract // extract
let extPath = sys.getPlatform() == 'windows' let extPath = sys.getPlatform() == 'windows'
@ -67,7 +67,6 @@ function findMatch(versionSpec, stable) {
if (parts.length == 2) { if (parts.length == 2) {
version = version + '.0'; version = version + '.0';
} }
//console.log(version, versionSpec);
if (semver.satisfies(version, versionSpec) && candidate.stable == stable) { if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
goFile = candidate.files.find(file => { goFile = candidate.files.find(file => {
return file.arch === archFilter && file.os === platFilter; return file.arch === archFilter && file.os === platFilter;

View File

@ -15,7 +15,7 @@ export async function downloadGo(
if (match) { if (match) {
// download // download
let downloadUrl: string = `https://storage.googleapis.com/golang/${match.files[0]}`; let downloadUrl: string = `https://storage.googleapis.com/golang/${match.files[0].filename}`;
let downloadPath: string = await tc.downloadTool(downloadUrl); let downloadPath: string = await tc.downloadTool(downloadUrl);
// extract // extract
@ -80,7 +80,6 @@ export async function findMatch(
version = version + '.0'; version = version + '.0';
} }
//console.log(version, versionSpec);
if (semver.satisfies(version, versionSpec) && candidate.stable == stable) { if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
goFile = candidate.files.find(file => { goFile = candidate.files.find(file => {
return file.arch === archFilter && file.os === platFilter; return file.arch === archFilter && file.os === platFilter;

View File

@ -10,8 +10,10 @@ export async function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted. // If not supplied then problem matchers will still be setup. Useful for self-hosted.
// //
let versionSpec = core.getInput('go-version'); let versionSpec = core.getInput('go-version');
let stable: boolean =
(core.getInput('stable') || '').toUpperCase() == 'TRUE'; // stable will be true unless false is the exact input
// since getting unstable versions should be explicit
let stable = Boolean(core.getInput('stable') || 'true');
if (versionSpec) { if (versionSpec) {
let installDir: string | undefined = tc.find('go', versionSpec); let installDir: string | undefined = tc.find('go', versionSpec);