Preserve native Go environment names in action outputs (#793)

* preserve native Go environment names in action outputs

* implement review comment

* Add missing trailing newline to action.yml

---------

Co-authored-by: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com>
This commit is contained in:
v-mahabaleshwars
2026-09-25 10:35:28 -05:00
committed by GitHub
co-authored by mahabaleshwars
parent e626ada899
commit 3bfff43db6
8 changed files with 93 additions and 101 deletions
+10 -8
View File
@@ -95641,16 +95641,18 @@ var State;
var Outputs;
(function (Outputs) {
Outputs["CacheHit"] = "cache-hit";
Outputs["GoPath"] = "go-path";
Outputs["GoBin"] = "go-bin";
Outputs["GoBinPath"] = "go-bin-path";
Outputs["GoRoot"] = "go-root";
Outputs["GoCache"] = "go-cache";
Outputs["GoModCache"] = "go-mod-cache";
Outputs["GoOs"] = "go-os";
Outputs["GoArch"] = "go-arch";
Outputs["GoToolDir"] = "go-tool-dir";
})(Outputs || (Outputs = {}));
const GO_ENV_OUTPUTS = (/* unused pure expression or super */ null && ([
'GOPATH',
'GOBIN',
'GOROOT',
'GOCACHE',
'GOMODCACHE',
'GOOS',
'GOARCH',
'GOTOOLDIR'
]));
;// CONCATENATED MODULE: ./src/package-managers.ts
const supportedPackageManagers = {
+14 -22
View File
@@ -100441,16 +100441,18 @@ var State;
var Outputs;
(function (Outputs) {
Outputs["CacheHit"] = "cache-hit";
Outputs["GoPath"] = "go-path";
Outputs["GoBin"] = "go-bin";
Outputs["GoBinPath"] = "go-bin-path";
Outputs["GoRoot"] = "go-root";
Outputs["GoCache"] = "go-cache";
Outputs["GoModCache"] = "go-mod-cache";
Outputs["GoOs"] = "go-os";
Outputs["GoArch"] = "go-arch";
Outputs["GoToolDir"] = "go-tool-dir";
})(Outputs || (Outputs = {}));
const GO_ENV_OUTPUTS = [
'GOPATH',
'GOBIN',
'GOROOT',
'GOCACHE',
'GOMODCACHE',
'GOOS',
'GOARCH',
'GOTOOLDIR'
];
;// CONCATENATED MODULE: ./src/package-managers.ts
const supportedPackageManagers = {
@@ -100674,24 +100676,14 @@ function readGoEnv(goPath) {
return undefined;
}
}
const goEnvOutputs = [
[Outputs.GoPath, 'GOPATH'],
[Outputs.GoBin, 'GOBIN'],
[Outputs.GoRoot, 'GOROOT'],
[Outputs.GoCache, 'GOCACHE'],
[Outputs.GoModCache, 'GOMODCACHE'],
[Outputs.GoOs, 'GOOS'],
[Outputs.GoArch, 'GOARCH'],
[Outputs.GoToolDir, 'GOTOOLDIR']
];
function setGoEnvOutputs(goEnv) {
for (const [output, variable] of goEnvOutputs) {
setOutput(output, goEnv[variable] ?? '');
for (const name of GO_ENV_OUTPUTS) {
setOutput(name, goEnv[name] ?? '');
}
setOutput(Outputs.GoBinPath, goEnv['GOBIN'] || goPathBin(goEnv));
setOutput(Outputs.GoBinPath, goEnv.GOBIN || goPathBin(goEnv));
}
function goPathBin(goEnv) {
const goPath = (goEnv['GOPATH'] ?? '').split((external_path_default()).delimiter)[0];
const goPath = (goEnv.GOPATH ?? '').split((external_path_default()).delimiter)[0];
return goPath ? external_path_default().join(goPath, 'bin') : '';
}
async function addBinToPath() {