10
0
Fork 0
mirror of https://github.com/actions/setup-go.git synced 2026-04-05 22:36:54 +00:00
This commit is contained in:
Tiger Kaovilai 2026-03-24 20:40:44 -04:00 committed by GitHub
commit 9ec2c28c8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 106938 additions and 152544 deletions

View file

@ -1059,6 +1059,12 @@ use .
expected_version: version,
desc: 'from toolchain directive'
},
{
goVersionfile: 'golangci-lint.mod',
fileContents: Buffer.from(buildGoMod(placeholderVersion, version)),
expected_version: version,
desc: 'from toolchain directive in non-standard .mod file'
},
{
goVersionfile: 'go.mod',
fileContents: Buffer.from(buildGoMod(placeholderVersion, version)),
@ -1072,6 +1078,13 @@ use .
gotoolchain_env: 'local',
expected_version: placeholderVersion,
desc: 'from go directive when GOTOOLCHAIN is local'
},
{
goVersionfile: 'golangci-lint.mod',
fileContents: Buffer.from(buildGoMod(placeholderVersion, version)),
gotoolchain_env: 'local',
expected_version: placeholderVersion,
desc: 'from go directive in non-standard .mod file when GOTOOLCHAIN is local'
}
].forEach(test => {
it(`reads version (${version}) in ${test.goVersionfile} ${test.desc}`, async () => {

129800
dist/cache-save/index.js vendored

File diff suppressed because one or more lines are too long

129667
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -654,7 +654,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
const contents = fs.readFileSync(versionFilePath).toString();
if (
path.basename(versionFilePath) === 'go.mod' ||
versionFilePath.endsWith('.mod') ||
path.basename(versionFilePath) === 'go.work'
) {
// for backwards compatibility: use version from go directive if