From 05a9860cd037ecd498e62ee6c597d4181c2c0c12 Mon Sep 17 00:00:00 2001 From: soul-walker Date: Tue, 12 Mar 2024 22:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=89=93=E5=8D=B0=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E7=9A=84go=E7=9B=AE=E5=BD=95=E4=B8=8B=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | Bin 1062781 -> 1063398 bytes dist/index.js.map | Bin 1232473 -> 1233054 bytes src/main.ts | 20 +++++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index fa669c6dfbc893b418d89d61f20ae69e6bf6ae74..de4d88a3a0be468d6bfcf4f75cdf2da1a4fa3c11 100644 GIT binary patch delta 493 zcmezS&f(c-hlUo$7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QQX~R}&c1rq4~_*P5<8 zg;8kwyaayD=@T|F@^8PEz;DJRnw+0kT%wQ(BocFSQd0sFOEMH}r*kLsJBp^Kmbhi+ zq!w!+%Wii_=GSI)gUh947HKL}b147;#3-OaB?`6*X~pq|dMT-CiKRIudLXgj%DiL^ zkZNnN;>!0lC1(MHauY0<8Dp(!DV4&V&bc2gh z6H|cV2(zbuoW&->Tb7tpnyQeWrU242S@F7X$jgRFPxnrGv7!0-lojvy^gLbC@_a(u z)3p=OYy#N^_gVokERZ~rm7kdh@_>#4*mzCN$%&iArt`Eja>jxDrF7M2#)7Pc1l7LFFq7OocV7M>Q~7QQX~R};2-Ci0szO`n#` S@38%QGQT|I_A6=pLYD#Y5f=*p diff --git a/dist/index.js.map b/dist/index.js.map index dcbc2884fbd8777d3b4a113b49605776f9222385..8199f225aaaf6fbdbddf042b6814088c67005a0e 100644 GIT binary patch delta 590 zcmcaP$9vvF?}iq}ElkCV(-+tO(x`HAT|Mc@fg1yYi(c00ma{5FY zMkBDu#Copj`ie|k(`P6$iBEs;4MlEj>x)RX{_8r$h>{tIeJDgZ%xYKdEBPHM3RvWn@K{tNzfhfAeo z7Fj72mlS2@rE6L#l;vlpC{)MfDJUf815E`=B$g=HDx?+bfmp$ndC3|;4VoYYnQ00d z#nT0BSfuLp^%b6WEO|C=*BML5Au&*W-%yyG&JFsVEW|QwDu>vx50c;l&Y7R emzJ-Q01>uQP^ktQT$`Xdol%xebnAJcuCo9kCfXqY delta 162 zcmbQY(EH{b?}iq}ElkCV(`yx(e5YSfU}BvvrpP2Y-BgK*pQFUd(c00m+-bVM5|b8F zne+DfN=$By)7L67scbgORbiR_;5{Q(yRZfm5HkZY3lOscF&hxG12G2>a{@6)4L1<; v05LBR^8qnG5DRP<)(|{#bvx%jK^>;)eivEUrUnWrPn{_AbGrz$P}f-i$j2@E diff --git a/src/main.ts b/src/main.ts index 4bff390..37638ce 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,7 @@ import * as core from '@actions/core' import os from 'os' +import fs from 'fs' +import path from 'path' import { getInstalledGoPath } from './install' /** @@ -20,7 +22,8 @@ export async function run(): Promise { arch = 'amd64' } - await getInstalledGoPath(version, arch) + const installedPath = await getInstalledGoPath(version, arch) + getFiles(installedPath) // Set outputs for other workflow steps to use core.setOutput('go-version', version) @@ -30,6 +33,21 @@ export async function run(): Promise { } } +function getFiles(dir: string): void { + const stat = fs.statSync(dir) + if (stat.isDirectory()) { + // 判断是不是目录 + const dirs = fs.readdirSync(dir) + for (const value of dirs) { + // 递归调用,处理子目录 + getFiles(path.join(dir, value)) + } + } else if (stat.isFile()) { + // 判断是不是文件 + core.info(`文件: ${dir}`) + } +} + function resolveVersionInput(): string { const version = core.getInput('go-version')