mirror of
https://github.com/actions/setup-go.git
synced 2026-06-28 18:55:08 +00:00
Merge 16c5d19d3e into e91cc3bfe0
This commit is contained in:
commit
afba3036e7
6 changed files with 67 additions and 1 deletions
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue