add support gowork for go-version-file

This commit is contained in:
koba1t
2022-11-01 19:13:57 +09:00
parent c4a742cab1
commit 7678c83214
7 changed files with 48 additions and 7 deletions

View File

@ -316,7 +316,10 @@ export function makeSemver(version: string): string {
export function parseGoVersionFile(versionFilePath: string): string {
const contents = fs.readFileSync(versionFilePath).toString();
if (path.basename(versionFilePath) === 'go.mod') {
if (
path.basename(versionFilePath) === 'go.mod' ||
path.basename(versionFilePath) === 'go.work'
) {
const match = contents.match(/^go (\d+(\.\d+)*)/m);
return match ? match[1] : '';
}