File tree 2 files changed +12
-24
lines changed
2 files changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -417,20 +417,6 @@ export function makeSemver(version: string): string {
417
417
return fullVersion ;
418
418
}
419
419
420
- export function parseGoVersionFile ( versionFilePath : string ) : string {
421
- const contents = fs . readFileSync ( versionFilePath ) . toString ( ) ;
422
-
423
- if (
424
- path . basename ( versionFilePath ) === 'go.mod' ||
425
- path . basename ( versionFilePath ) === 'go.work'
426
- ) {
427
- const match = contents . match ( / ^ g o ( \d + ( \. \d + ) * ) / m) ;
428
- return match ? match [ 1 ] : '' ;
429
- }
430
-
431
- return contents . trim ( ) ;
432
- }
433
-
434
420
async function resolveStableVersionDist ( versionSpec : string , arch : string ) {
435
421
const archFilter = sys . getArch ( arch ) ;
436
422
const platFilter = sys . getPlatform ( ) ;
Original file line number Diff line number Diff line change @@ -143,22 +143,24 @@ function resolveVersionInput(): string {
143
143
core . warning (
144
144
'Both go-version and go-version-file inputs are specified, only go-version will be used'
145
145
) ;
146
+ versionFilePath = '' ;
146
147
}
147
-
148
- if ( version ) {
149
- if ( ! version . endsWith ( 'go.mod' ) ) {
150
- return version ;
151
- }
152
- versionFilePath = version ;
148
+ if ( versionFilePath ) {
149
+ version = versionFilePath ;
153
150
}
154
151
155
- if ( versionFilePath ) {
156
- if ( ! fs . existsSync ( versionFilePath ) ) {
152
+ if (
153
+ path . basename ( version ) === 'go.mod' ||
154
+ path . basename ( version ) === 'go.work'
155
+ ) {
156
+ if ( ! fs . existsSync ( version ) ) {
157
157
throw new Error (
158
- `The specified go version file at: ${ versionFilePath } does not exist`
158
+ `The specified go version file at: ${ version } does not exist`
159
159
) ;
160
160
}
161
- version = installer . parseGoVersionFile ( versionFilePath ) ;
161
+ const contents = fs . readFileSync ( version ) . toString ( ) ;
162
+ const match = contents . match ( / ^ g o ( \d + ( \. \d + ) * ) / m) ;
163
+ return match ? match [ 1 ] : '' ;
162
164
}
163
165
164
166
return version ;
You can’t perform that action at this time.
0 commit comments