From 83124a14b6a7860a85fe88a6cd82b86f05fb2cf9 Mon Sep 17 00:00:00 2001
From: Manuel Mendez <mmendez534@gmail.com>
Date: Tue, 14 Dec 2021 13:24:18 -0500
Subject: [PATCH] Do not export GOROOT

This has not been necessary since [Go 1.9](https://go.dev/doc/go1.9#goroot) at
least (although clunky to do so then) but definitely not since
[Go 1.10](https://go.dev/doc/go1.10#goroot).

This is cargo culting code that is more than 2 years out of date and runs into
issues when multiple go versions are used in an action run.

Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
---
 __tests__/setup-go.test.ts | 4 ++--
 dist/index.js              | 1 -
 src/main.ts                | 1 -
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts
index 6be0c03..7bb3828 100644
--- a/__tests__/setup-go.test.ts
+++ b/__tests__/setup-go.test.ts
@@ -231,7 +231,7 @@ describe('setup-go', () => {
     expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
   });
 
-  it('exports GOROOT', async () => {
+  it('does not export any varibles', async () => {
     inputs['go-version'] = '1.13.0';
     inSpy.mockImplementation(name => inputs[name]);
 
@@ -244,7 +244,7 @@ describe('setup-go', () => {
     });
 
     await main.run();
-    expect(vars).toBe({GOROOT: 'foo'});
+    expect(vars).toStrictEqual({});
   });
 
   it('finds a version of go already in the cache', async () => {
diff --git a/dist/index.js b/dist/index.js
index ac3d0e5..87ff0a4 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -2080,7 +2080,6 @@ function run() {
                 let auth = !token || isGhes() ? undefined : `token ${token}`;
                 const checkLatest = core.getBooleanInput('check-latest');
                 const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
-                core.exportVariable('GOROOT', installDir);
                 core.addPath(path_1.default.join(installDir, 'bin'));
                 core.info('Added go to the path');
                 let added = yield addBinToPath();
diff --git a/src/main.ts b/src/main.ts
index f785b85..7a9c1f5 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -23,7 +23,6 @@ export async function run() {
       const checkLatest = core.getBooleanInput('check-latest');
       const installDir = await installer.getGo(versionSpec, checkLatest, auth);
 
-      core.exportVariable('GOROOT', installDir);
       core.addPath(path.join(installDir, 'bin'));
       core.info('Added go to the path');