Add support for beta versions in go.mod toolchain directive

pull/701/head
Arne Jørgensen 2 weeks ago
parent 5b8c8e18e1
commit fe60385a94
No known key found for this signature in database

@ -1237,7 +1237,7 @@ use .
}); });
describe('go-version-file-toolchain', () => { describe('go-version-file-toolchain', () => {
const goVersions = ['1.22.0', '1.21rc2', '1.18']; const goVersions = ['1.22.0', '1.21rc2', '1.18', '1.18beta2'];
const placeholderVersion = '1.19'; const placeholderVersion = '1.19';
const buildGoMod = ( const buildGoMod = (
goVersion: string, goVersion: string,

@ -42367,7 +42367,7 @@ function parseGoVersionFile(versionFilePath) {
// 'GOTOOLCHAIN' has been explicitly set // 'GOTOOLCHAIN' has been explicitly set
if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) { if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) {
// toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain // toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain
const matchToolchain = contents.match(/^toolchain go(1\.\d+(?:\.\d+|rc\d+)?)/m); const matchToolchain = contents.match(/^toolchain go(1\.\d+(?:\.\d+|(beta|rc)\d+)?)/m);
if (matchToolchain) { if (matchToolchain) {
return matchToolchain[1]; return matchToolchain[1];
} }

@ -657,7 +657,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) { if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) {
// toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain // toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain
const matchToolchain = contents.match( const matchToolchain = contents.match(
/^toolchain go(1\.\d+(?:\.\d+|rc\d+)?)/m /^toolchain go(1\.\d+(?:\.\d+|(beta|rc)\d+)?)/m
); );
if (matchToolchain) { if (matchToolchain) {
return matchToolchain[1]; return matchToolchain[1];

Loading…
Cancel
Save