Skip to content

Commit

Permalink
Do not export GOROOT
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mmlb committed Mar 10, 2022
1 parent ec07be5 commit 3f602c0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions __tests__/setup-go.test.ts
Expand Up @@ -231,7 +231,7 @@ describe('setup-go', () => {
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
});

it('exports GOROOT', async () => {
it('doest not export any varibles', async () => {
inputs['go-version'] = '1.13.0';
inSpy.mockImplementation(name => inputs[name]);

Expand All @@ -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 () => {
Expand Down
1 change: 0 additions & 1 deletion dist/index.js
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/main.ts
Expand Up @@ -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');

Expand Down

0 comments on commit 3f602c0

Please sign in to comment.