From 3c844703e748caa5d1cabb81044dec1b8fc7ed15 Mon Sep 17 00:00:00 2001
From: Bryan MacFarlane <bryanmacfarlane@github.com>
Date: Sun, 9 Feb 2020 08:44:32 -0500
Subject: [PATCH] bugs

---
 action.yml       | 2 +-
 dist/index.js    | 7 ++++---
 lib/installer.js | 3 +--
 src/installer.ts | 3 +--
 src/main.ts      | 6 ++++--
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/action.yml b/action.yml
index 87869bc..5239aa7 100644
--- a/action.yml
+++ b/action.yml
@@ -1,5 +1,5 @@
 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'
 inputs: 
   go-version:
diff --git a/dist/index.js b/dist/index.js
index abf8c8e..9e559f0 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1287,7 +1287,9 @@ function run() {
             // If not supplied then problem matchers will still be setup.  Useful for self-hosted.
             //
             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) {
                 let installDir = tc.find('go', versionSpec);
                 if (!installDir) {
@@ -4588,7 +4590,7 @@ function downloadGo(versionSpec, stable) {
             let match = yield findMatch(versionSpec, stable);
             if (match) {
                 // 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);
                 // extract
                 let extPath = sys.getPlatform() == 'windows'
@@ -4628,7 +4630,6 @@ function findMatch(versionSpec, stable) {
             if (parts.length == 2) {
                 version = version + '.0';
             }
-            //console.log(version, versionSpec);
             if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
                 goFile = candidate.files.find(file => {
                     return file.arch === archFilter && file.os === platFilter;
diff --git a/lib/installer.js b/lib/installer.js
index 04efe48..5688337 100644
--- a/lib/installer.js
+++ b/lib/installer.js
@@ -27,7 +27,7 @@ function downloadGo(versionSpec, stable) {
             let match = yield findMatch(versionSpec, stable);
             if (match) {
                 // 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);
                 // extract
                 let extPath = sys.getPlatform() == 'windows'
@@ -67,7 +67,6 @@ function findMatch(versionSpec, stable) {
             if (parts.length == 2) {
                 version = version + '.0';
             }
-            //console.log(version, versionSpec);
             if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
                 goFile = candidate.files.find(file => {
                     return file.arch === archFilter && file.os === platFilter;
diff --git a/src/installer.ts b/src/installer.ts
index a719df7..74104f6 100644
--- a/src/installer.ts
+++ b/src/installer.ts
@@ -15,7 +15,7 @@ export async function downloadGo(
 
     if (match) {
       // 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);
 
       // extract
@@ -80,7 +80,6 @@ export async function findMatch(
       version = version + '.0';
     }
 
-    //console.log(version, versionSpec);
     if (semver.satisfies(version, versionSpec) && candidate.stable == stable) {
       goFile = candidate.files.find(file => {
         return file.arch === archFilter && file.os === platFilter;
diff --git a/src/main.ts b/src/main.ts
index 8defc5e..e77eeaf 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -10,8 +10,10 @@ export async function run() {
     // If not supplied then problem matchers will still be setup.  Useful for self-hosted.
     //
     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) {
       let installDir: string | undefined = tc.find('go', versionSpec);