Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not export GOROOT for Go versions >= 1.9 #175

Merged
merged 6 commits into from Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions __tests__/setup-go.test.ts
Expand Up @@ -49,6 +49,7 @@ describe('setup-go', () => {
inSpy.mockImplementation(name => inputs[name]);
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation(name => inputs[name]);
exSpy = jest.spyOn(core, 'exportVariable');

// node
os = {};
Expand Down Expand Up @@ -230,6 +231,22 @@ describe('setup-go', () => {
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
});

it('does not export any varibles', async () => {
joshmgross marked this conversation as resolved.
Show resolved Hide resolved
inputs['go-version'] = '1.13.0';
inSpy.mockImplementation(name => inputs[name]);

let toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);

let vars = {} as any;
exSpy.mockImplementation(async (name, val) => {
vars[name] = val;
});

await main.run();
expect(vars).toStrictEqual({});
});

it('finds a version of go already in the cache', async () => {
inputs['go-version'] = '1.13.0';

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