mirror of
https://github.com/actions/setup-go.git
synced 2025-12-17 05:02:34 +00:00
add .tool-versions file support
This commit is contained in:
parent
20d79c58dd
commit
4faced9210
7 changed files with 62 additions and 14 deletions
|
|
@ -866,6 +866,9 @@ exclude example.com/thismodule v1.3.0
|
|||
|
||||
use .
|
||||
|
||||
`;
|
||||
|
||||
const toolVersionsContents = `golang 1.23
|
||||
`;
|
||||
|
||||
it('reads version from go.mod', async () => {
|
||||
|
|
@ -892,6 +895,18 @@ use .
|
|||
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
|
||||
});
|
||||
|
||||
it('reads version from .tool-versions', async () => {
|
||||
inputs['go-version-file'] = '.tool-versions';
|
||||
existsSpy.mockImplementation(() => true);
|
||||
readFileSpy.mockImplementation(() => Buffer.from(toolVersionsContents));
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.23');
|
||||
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.23...');
|
||||
expect(logSpy).toHaveBeenCalledWith('matching 1.23...');
|
||||
});
|
||||
|
||||
it('reads version from .go-version', async () => {
|
||||
inputs['go-version-file'] = '.go-version';
|
||||
existsSpy.mockImplementation(() => true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue