@ -63007,7 +63007,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype. hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
@ -63032,7 +63032,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
const fs _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 7147 ) ) ;
const constants _1 = _ _nccwpck _require _ _ ( 9042 ) ;
const cache _utils _1 = _ _nccwpck _require _ _ ( 1678 ) ;
exports . restoreCache = ( versionSpec , packageManager , cacheDependencyPath ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
const restoreCache = ( versionSpec , packageManager , cacheDependencyPath ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
const packageManagerInfo = yield cache _utils _1 . getPackageManagerInfo ( packageManager ) ;
const platform = process . env . RUNNER _OS ;
const cachePaths = yield cache _utils _1 . getCacheDirectoryPath ( packageManagerInfo ) ;
@ -63056,6 +63056,7 @@ exports.restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __a
core . saveState ( constants _1 . State . CacheMatchedKey , cacheKey ) ;
core . info ( ` Cache restored from key: ${ cacheKey } ` ) ;
} ) ;
exports . restoreCache = restoreCache ;
const findDependencyFile = ( packageManager ) => {
let dependencyFile = packageManager . dependencyFilePattern ;
const workspace = process . env . GITHUB _WORKSPACE ;
@ -63090,7 +63091,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype. hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
@ -63109,7 +63110,7 @@ const cache = __importStar(__nccwpck_require__(7799));
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const exec = _ _importStar ( _ _nccwpck _require _ _ ( 1514 ) ) ;
const package _managers _1 = _ _nccwpck _require _ _ ( 6663 ) ;
exports . getCommandOutput = ( toolCommand ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
const getCommandOutput = ( toolCommand ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
let { stdout , stderr , exitCode } = yield exec . getExecOutput ( toolCommand , undefined , { ignoreReturnCode : true } ) ;
if ( exitCode ) {
stderr = ! stderr . trim ( )
@ -63119,14 +63120,16 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
}
return stdout . trim ( ) ;
} ) ;
exports . getPackageManagerInfo = ( packageManager ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
exports . getCommandOutput = getCommandOutput ;
const getPackageManagerInfo = ( packageManager ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
if ( ! package _managers _1 . supportedPackageManagers [ packageManager ] ) {
throw new Error ( ` It's not possible to use ${ packageManager } , please, check correctness of the package manager name spelling. ` ) ;
}
const obtainedPackageManager = package _managers _1 . supportedPackageManagers [ packageManager ] ;
return obtainedPackageManager ;
} ) ;
exports . getCacheDirectoryPath = ( packageManagerInfo ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
exports . getPackageManagerInfo = getPackageManagerInfo ;
const getCacheDirectoryPath = ( packageManagerInfo ) => _ _awaiter ( void 0 , void 0 , void 0 , function * ( ) {
let pathList = yield Promise . all ( packageManagerInfo . cacheFolderCommandList . map ( command => exports . getCommandOutput ( command ) ) ) ;
const emptyPaths = pathList . filter ( item => ! item ) ;
if ( emptyPaths . length ) {
@ -63134,6 +63137,7 @@ exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0
}
return pathList ;
} ) ;
exports . getCacheDirectoryPath = getCacheDirectoryPath ;
function isGhes ( ) {
const ghUrl = new URL ( process . env [ 'GITHUB_SERVER_URL' ] || 'https://github.com' ) ;
return ghUrl . hostname . toUpperCase ( ) !== 'GITHUB.COM' ;
@ -63196,7 +63200,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype. hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
@ -63213,7 +63217,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return ( mod && mod . _ _esModule ) ? mod : { "default" : mod } ;
} ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . parseGoVersionFile = exports . makeSemver = exports . getVersionsDist = exports . findMatch = exports . getInfoFrom Manifest = exports . extractGoArchive = exports . getGo = void 0 ;
exports . resolveStableVersionInput = exports . parseGoVersionFile = exports . makeSemver = exports . getVersionsDist = exports . findMatch = exports . getInfoFrom Manifest = exports . get Manifest = exports . extractGoArchive = exports . getGo = void 0 ;
const tc = _ _importStar ( _ _nccwpck _require _ _ ( 7784 ) ) ;
const core = _ _importStar ( _ _nccwpck _require _ _ ( 2186 ) ) ;
const path = _ _importStar ( _ _nccwpck _require _ _ ( 1017 ) ) ;
@ -63222,12 +63226,26 @@ const httpm = __importStar(__nccwpck_require__(6255));
const sys = _ _importStar ( _ _nccwpck _require _ _ ( 4300 ) ) ;
const fs _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 7147 ) ) ;
const os _1 = _ _importDefault ( _ _nccwpck _require _ _ ( 2037 ) ) ;
const utils _1 = _ _nccwpck _require _ _ ( 1314 ) ;
function getGo ( versionSpec , checkLatest , auth , arch = os _1 . default . arch ( ) ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
let manifest ;
let osPlat = os _1 . default . platform ( ) ;
if ( versionSpec === utils _1 . StableReleaseAlias . Stable ||
versionSpec === utils _1 . StableReleaseAlias . OldStable ) {
manifest = yield getManifest ( auth ) ;
let stableVersion = yield resolveStableVersionInput ( versionSpec , arch , osPlat , manifest ) ;
if ( ! stableVersion ) {
stableVersion = yield resolveStableVersionDist ( versionSpec , arch ) ;
if ( ! stableVersion ) {
throw new Error ( ` Unable to find Go version ' ${ versionSpec } ' for platform ${ osPlat } and architecture ${ arch } . ` ) ;
}
}
versionSpec = stableVersion ;
}
if ( checkLatest ) {
core . info ( 'Attempting to resolve the latest version from the manifest...' ) ;
const resolvedVersion = yield resolveVersionFromManifest ( versionSpec , true , auth , arch ) ;
const resolvedVersion = yield resolveVersionFromManifest ( versionSpec , true , auth , arch , manifest );
if ( resolvedVersion ) {
versionSpec = resolvedVersion ;
core . info ( ` Resolved as ' ${ versionSpec } ' ` ) ;
@ -63251,7 +63269,7 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
// Try download from internal distribution (popular versions only)
//
try {
info = yield getInfoFromManifest ( versionSpec , true , auth , arch );
info = yield getInfoFromManifest ( versionSpec , true , auth , arch , manifest );
if ( info ) {
downloadPath = yield installGoVersion ( info , auth , arch ) ;
}
@ -63290,10 +63308,10 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
} ) ;
}
exports . getGo = getGo ;
function resolveVersionFromManifest ( versionSpec , stable , auth , arch ) {
function resolveVersionFromManifest ( versionSpec , stable , auth , arch , manifest ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
try {
const info = yield getInfoFromManifest ( versionSpec , stable , auth , arch );
const info = yield getInfoFromManifest ( versionSpec , stable , auth , arch , manifest );
return info === null || info === void 0 ? void 0 : info . resolvedVersion ;
}
catch ( err ) {
@ -63336,12 +63354,21 @@ function extractGoArchive(archivePath) {
} ) ;
}
exports . extractGoArchive = extractGoArchive ;
function getInfoFromManifest ( versionSpec , stable , auth , arch = os _1 . default . arch ( ) ) {
function getManifest ( auth ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
return tc . getManifestFromRepo ( 'actions' , 'go-versions' , auth , 'main' ) ;
} ) ;
}
exports . getManifest = getManifest ;
function getInfoFromManifest ( versionSpec , stable , auth , arch = os _1 . default . arch ( ) , manifest ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
let info = null ;
const releases = yield tc . getManifestFromRepo ( 'actions' , 'go-versions' , auth , 'main' ) ;
if ( ! manifest ) {
core . debug ( 'No manifest cached' ) ;
manifest = yield getManifest ( auth ) ;
}
core . info ( ` matching ${ versionSpec } ... ` ) ;
const rel = yield tc . findFromManifest ( versionSpec , stable , releases , arch ) ;
const rel = yield tc . findFromManifest ( versionSpec , stable , manifest , arch ) ;
if ( rel && rel . files . length > 0 ) {
info = { } ;
info . type = 'manifest' ;
@ -63452,6 +63479,47 @@ function parseGoVersionFile(versionFilePath) {
return contents . trim ( ) ;
}
exports . parseGoVersionFile = parseGoVersionFile ;
function resolveStableVersionDist ( versionSpec , arch ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
let archFilter = sys . getArch ( arch ) ;
let platFilter = sys . getPlatform ( ) ;
const dlUrl = 'https://golang.org/dl/?mode=json&include=all' ;
let candidates = yield module . exports . getVersionsDist ( dlUrl ) ;
if ( ! candidates ) {
throw new Error ( ` golang download url did not return results ` ) ;
}
const fixedCandidates = candidates . map ( item => {
return Object . assign ( Object . assign ( { } , item ) , { version : makeSemver ( item . version ) } ) ;
} ) ;
const stableVersion = yield resolveStableVersionInput ( versionSpec , archFilter , platFilter , fixedCandidates ) ;
return stableVersion ;
} ) ;
}
function resolveStableVersionInput ( versionSpec , arch , platform , manifest ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
const releases = manifest
. map ( item => {
const index = item . files . findIndex ( item => item . arch === arch && item . filename . includes ( platform ) ) ;
if ( index === - 1 ) {
return '' ;
}
return item . version ;
} )
. filter ( item => ! ! item && ! semver . prerelease ( item ) ) ;
if ( versionSpec === utils _1 . StableReleaseAlias . Stable ) {
core . info ( ` stable version resolved as ${ releases [ 0 ] } ` ) ;
return releases [ 0 ] ;
}
else {
const versions = releases . map ( release => ` ${ semver . major ( release ) } . ${ semver . minor ( release ) } ` ) ;
const uniqueVersions = Array . from ( new Set ( versions ) ) ;
const oldstableVersion = releases . find ( item => item . startsWith ( uniqueVersions [ 1 ] ) ) ;
core . info ( ` oldstable version resolved as ${ oldstableVersion } ` ) ;
return oldstableVersion ;
}
} ) ;
}
exports . resolveStableVersionInput = resolveStableVersionInput ;
/***/ } ) ,
@ -63476,7 +63544,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype. hasOwnProperty. call ( mod , k ) ) _ _createBinding ( result , mod , k ) ;
_ _setModuleDefault ( result , mod ) ;
return result ;
} ;
@ -63523,9 +63591,10 @@ function run() {
let auth = ! token ? undefined : ` token ${ token } ` ;
const checkLatest = core . getBooleanInput ( 'check-latest' ) ;
const installDir = yield installer . getGo ( versionSpec , checkLatest , auth , arch ) ;
const installDirVersion = path _1 . default . basename ( path _1 . default . dirname ( installDir ) ) ;
core . addPath ( path _1 . default . join ( installDir , 'bin' ) ) ;
core . info ( 'Added go to the path' ) ;
const version = installer . makeSemver ( versionSpec ) ;
const version = installer . makeSemver ( installDirVersion ) ;
// Go versions less than 1.9 require GOROOT to be set
if ( semver . lt ( version , '1.9.0' ) ) {
core . info ( 'Setting GOROOT for Go version < 1.9' ) ;
@ -63678,6 +63747,22 @@ function getArch(arch) {
exports . getArch = getArch ;
/***/ } ) ,
/***/ 1314 :
/***/ ( ( _ _unused _webpack _module , exports ) => {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
exports . StableReleaseAlias = void 0 ;
var StableReleaseAlias ;
( function ( StableReleaseAlias ) {
StableReleaseAlias [ "Stable" ] = "stable" ;
StableReleaseAlias [ "OldStable" ] = "oldstable" ;
} ) ( StableReleaseAlias = exports . StableReleaseAlias || ( exports . StableReleaseAlias = { } ) ) ;
/***/ } ) ,
/***/ 2877 :