This commit is contained in:
RaeCheol Park 2026-06-23 10:08:49 +00:00 committed by GitHub
commit afba3036e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 67 additions and 1 deletions

View file

@ -1112,6 +1112,31 @@ use .
expect(process.env).toHaveProperty('GOTOOLCHAIN', 'local');
});
describe('auto-detect go.mod', () => {
it('uses go.mod from workspace root when no inputs provided', async () => {
existsSpy.mockImplementation((filePath: string) => {
return filePath === 'go.mod';
});
readFileSpy.mockImplementation(() =>
Buffer.from('module test\n\ngo 1.20')
);
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.20');
});
it('uses pre-installed Go when no inputs and no go.mod exists', async () => {
existsSpy.mockImplementation(() => false);
await main.run();
expect(logSpy).toHaveBeenCalledWith(
'[warning]go-version input was not specified. The action will try to use pre-installed version.'
);
});
});
describe('go-download-base-url', () => {
it('downloads a version from custom base URL using version listing', async () => {
os.platform = 'linux';