mirror of
https://github.com/actions/setup-go.git
synced 2026-02-21 22:25:03 +08:00
Compare commits
1 Commits
9f5f83153c
...
v5.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0aaccfd150 |
37
.github/workflows/windows-validation.yml
vendored
37
.github/workflows/windows-validation.yml
vendored
@@ -134,40 +134,3 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: ${{ matrix.cache }}
|
||||
|
||||
go-mod-cache-and-tmp-location:
|
||||
name: 'Validate if GOCACHE, GOMODCACHE, GOTMPDIR is set to drive D:'
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
cache: [false]
|
||||
go: [1.20.1]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
|
||||
uses: ./
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: ${{ matrix.cache }}
|
||||
|
||||
- name: 'Check if go mod cache and tmp location is set correctly'
|
||||
run: |
|
||||
go env GOCACHE
|
||||
go env GOMODCACHE
|
||||
go env GOTMPDIR
|
||||
|
||||
if [ $(go env GOCACHE) != 'D:\Users\runneradmin\AppData\Local\go-build' ];then
|
||||
echo 'go env GOCACHE should return "D:\Users\runneradmin\AppData\Local\go-build"'
|
||||
exit 1
|
||||
fi
|
||||
if [ $(go env GOMODCACHE) != 'D:\Users\runneradmin\go\pkg\mod' ];then
|
||||
echo 'go env GOMODCACHE should return "D:\Users\runneradmin\go\pkg\mod"'
|
||||
exit 1
|
||||
fi
|
||||
if [ $(go env GOTMPDIR) != 'D:\gotmp' ];then
|
||||
echo 'go env GOTMPDIR should return "D:\gotmp"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell: bash
|
||||
|
||||
2
.licenses/npm/undici.dep.yml
generated
2
.licenses/npm/undici.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: undici
|
||||
version: 5.28.4
|
||||
version: 5.28.5
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
|
||||
18
dist/cache-save/index.js
vendored
18
dist/cache-save/index.js
vendored
@@ -65451,6 +65451,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(9830)
|
||||
const { File: UndiciFile } = __nccwpck_require__(8511)
|
||||
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
|
||||
|
||||
let random
|
||||
try {
|
||||
const crypto = __nccwpck_require__(6005)
|
||||
random = (max) => crypto.randomInt(0, max)
|
||||
} catch {
|
||||
random = (max) => Math.floor(Math.random(max))
|
||||
}
|
||||
|
||||
let ReadableStream = globalThis.ReadableStream
|
||||
|
||||
/** @type {globalThis['File']} */
|
||||
@@ -65536,7 +65544,7 @@ function extractBody (object, keepalive = false) {
|
||||
// Set source to a copy of the bytes held by object.
|
||||
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
|
||||
} else if (util.isFormDataLike(object)) {
|
||||
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
|
||||
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
|
||||
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
|
||||
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
@@ -86891,6 +86899,14 @@ module.exports = require("net");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6005:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5673:
|
||||
/***/ ((module) => {
|
||||
|
||||
|
||||
57
dist/setup/index.js
vendored
57
dist/setup/index.js
vendored
@@ -71739,6 +71739,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(9830)
|
||||
const { File: UndiciFile } = __nccwpck_require__(8511)
|
||||
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
|
||||
|
||||
let random
|
||||
try {
|
||||
const crypto = __nccwpck_require__(6005)
|
||||
random = (max) => crypto.randomInt(0, max)
|
||||
} catch {
|
||||
random = (max) => Math.floor(Math.random(max))
|
||||
}
|
||||
|
||||
let ReadableStream = globalThis.ReadableStream
|
||||
|
||||
/** @type {globalThis['File']} */
|
||||
@@ -71824,7 +71832,7 @@ function extractBody (object, keepalive = false) {
|
||||
// Set source to a copy of the bytes held by object.
|
||||
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
|
||||
} else if (util.isFormDataLike(object)) {
|
||||
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
|
||||
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
|
||||
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
|
||||
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||
@@ -92932,7 +92940,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.setWindowsCacheDirectories = exports.restoreCache = void 0;
|
||||
exports.restoreCache = void 0;
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
@@ -92940,7 +92948,6 @@ 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);
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager);
|
||||
const platform = process.env.RUNNER_OS;
|
||||
@@ -92968,41 +92975,6 @@ const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awa
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
});
|
||||
exports.restoreCache = restoreCache;
|
||||
const setWindowsCacheDirectories = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (os_1.default.platform() !== 'win32')
|
||||
return;
|
||||
let goCache = yield (0, cache_utils_1.getCommandOutput)(`go env GOCACHE`);
|
||||
core.info(`GOCACHE: ${goCache}`);
|
||||
goCache = goCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
if (!fs_1.default.existsSync(goCache)) {
|
||||
core.info(`${goCache} does not exist. Creating`);
|
||||
fs_1.default.mkdirSync(goCache, { recursive: true });
|
||||
}
|
||||
const setOutput = yield (0, cache_utils_1.getCommandOutput)(`go env -w GOCACHE=${goCache}`);
|
||||
core.info(`go env -w GOCACHE output: ${setOutput}`);
|
||||
let goModCache = yield (0, cache_utils_1.getCommandOutput)(`go env GOMODCACHE`);
|
||||
core.info(`GOMODCACHE: ${goModCache}`);
|
||||
goModCache = goModCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
if (!fs_1.default.existsSync(goModCache)) {
|
||||
core.info(`${goModCache} does not exist. Creating`);
|
||||
fs_1.default.mkdirSync(goModCache, { recursive: true });
|
||||
}
|
||||
const setModOutput = yield (0, cache_utils_1.getCommandOutput)(`go env -w GOMODCACHE=${goModCache}`);
|
||||
core.info(`go env -w GOMODCACHE output: ${setModOutput}`);
|
||||
let goTmpDir = yield (0, cache_utils_1.getCommandOutput)(`go env GOTMPDIR`);
|
||||
core.info(`GOTMPDIR: ${goTmpDir}`);
|
||||
if (!goTmpDir || goTmpDir === '') {
|
||||
goTmpDir = 'D:\\gotmp';
|
||||
}
|
||||
goTmpDir = goTmpDir.replace('C:', 'D:').replace('c:', 'd:');
|
||||
if (!fs_1.default.existsSync(goTmpDir)) {
|
||||
core.info(`${goTmpDir} does not exist. Creating`);
|
||||
fs_1.default.mkdirSync(goTmpDir, { recursive: true });
|
||||
}
|
||||
const setGoTmpOutput = yield (0, cache_utils_1.getCommandOutput)(`go env -w GOTMPDIR=${goTmpDir}`);
|
||||
core.info(`go env -w GOTMPDIR output: ${setGoTmpOutput}`);
|
||||
});
|
||||
exports.setWindowsCacheDirectories = setWindowsCacheDirectories;
|
||||
const findDependencyFile = (packageManager) => {
|
||||
const dependencyFile = packageManager.dependencyFilePattern;
|
||||
const workspace = process.env.GITHUB_WORKSPACE;
|
||||
@@ -93615,7 +93587,6 @@ const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield (0, cache_restore_1.setWindowsCacheDirectories)();
|
||||
//
|
||||
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||
@@ -93929,6 +93900,14 @@ module.exports = require("net");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6005:
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("node:crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5673:
|
||||
/***/ ((module) => {
|
||||
|
||||
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -5793,9 +5793,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.28.4",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
|
||||
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
|
||||
"version": "5.28.5",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -4,14 +4,9 @@ import * as glob from '@actions/glob';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
import {Outputs, State} from './constants';
|
||||
import {State, Outputs} from './constants';
|
||||
import {PackageManagerInfo} from './package-managers';
|
||||
import {
|
||||
getCacheDirectoryPath,
|
||||
getCommandOutput,
|
||||
getPackageManagerInfo
|
||||
} from './cache-utils';
|
||||
import os from 'os';
|
||||
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
||||
|
||||
export const restoreCache = async (
|
||||
versionSpec: string,
|
||||
@@ -55,53 +50,6 @@ export const restoreCache = async (
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
};
|
||||
|
||||
export const setWindowsCacheDirectories = async () => {
|
||||
if (os.platform() !== 'win32') return;
|
||||
|
||||
let goCache = await getCommandOutput(`go env GOCACHE`);
|
||||
core.info(`GOCACHE: ${goCache}`);
|
||||
goCache = goCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goCache)) {
|
||||
core.info(`${goCache} does not exist. Creating`);
|
||||
fs.mkdirSync(goCache, {recursive: true});
|
||||
}
|
||||
|
||||
const setOutput = await getCommandOutput(`go env -w GOCACHE=${goCache}`);
|
||||
core.info(`go env -w GOCACHE output: ${setOutput}`);
|
||||
|
||||
let goModCache = await getCommandOutput(`go env GOMODCACHE`);
|
||||
core.info(`GOMODCACHE: ${goModCache}`);
|
||||
goModCache = goModCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goModCache)) {
|
||||
core.info(`${goModCache} does not exist. Creating`);
|
||||
fs.mkdirSync(goModCache, {recursive: true});
|
||||
}
|
||||
|
||||
const setModOutput = await getCommandOutput(
|
||||
`go env -w GOMODCACHE=${goModCache}`
|
||||
);
|
||||
core.info(`go env -w GOMODCACHE output: ${setModOutput}`);
|
||||
|
||||
let goTmpDir = await getCommandOutput(`go env GOTMPDIR`);
|
||||
core.info(`GOTMPDIR: ${goTmpDir}`);
|
||||
if (!goTmpDir || goTmpDir === '') {
|
||||
goTmpDir = 'D:\\gotmp';
|
||||
}
|
||||
goTmpDir = goTmpDir.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goTmpDir)) {
|
||||
core.info(`${goTmpDir} does not exist. Creating`);
|
||||
fs.mkdirSync(goTmpDir, {recursive: true});
|
||||
}
|
||||
|
||||
const setGoTmpOutput = await getCommandOutput(
|
||||
`go env -w GOTMPDIR=${goTmpDir}`
|
||||
);
|
||||
core.info(`go env -w GOTMPDIR output: ${setGoTmpOutput}`);
|
||||
};
|
||||
|
||||
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
||||
const dependencyFile = packageManager.dependencyFilePattern;
|
||||
const workspace = process.env.GITHUB_WORKSPACE!;
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as io from '@actions/io';
|
||||
import * as installer from './installer';
|
||||
import * as semver from 'semver';
|
||||
import path from 'path';
|
||||
import {restoreCache, setWindowsCacheDirectories} from './cache-restore';
|
||||
import {restoreCache} from './cache-restore';
|
||||
import {isCacheFeatureAvailable} from './cache-utils';
|
||||
import cp from 'child_process';
|
||||
import fs from 'fs';
|
||||
@@ -11,7 +11,6 @@ import os from 'os';
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
await setWindowsCacheDirectories();
|
||||
//
|
||||
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||
|
||||
Reference in New Issue
Block a user