mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-08 03:28:21 +02:00
add support gowork for go-version-file
This commit is contained in:
parent
c4a742cab1
commit
7678c83214
7 changed files with 48 additions and 7 deletions
3
__tests__/data/go.work
Normal file
3
__tests__/data/go.work
Normal file
|
@ -0,0 +1,3 @@
|
|||
go 1.19
|
||||
|
||||
use .
|
|
@ -824,6 +824,12 @@ require (
|
|||
|
||||
replace example.com/thatmodule => ../thatmodule
|
||||
exclude example.com/thismodule v1.3.0
|
||||
`;
|
||||
|
||||
const goWorkContents = `go 1.19
|
||||
|
||||
use .
|
||||
|
||||
`;
|
||||
|
||||
it('reads version from go.mod', async () => {
|
||||
|
@ -838,6 +844,18 @@ exclude example.com/thismodule v1.3.0
|
|||
expect(logSpy).toHaveBeenCalledWith('matching 1.14...');
|
||||
});
|
||||
|
||||
it('reads version from go.work', async () => {
|
||||
inputs['go-version-file'] = 'go.work';
|
||||
existsSpy.mockImplementation(() => true);
|
||||
readFileSpy.mockImplementation(() => Buffer.from(goWorkContents));
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.19');
|
||||
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.19...');
|
||||
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
|
||||
});
|
||||
|
||||
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