massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-go / lib / utils / tools.js
index 655d7a5f46794b203711a6d6cc03a3a0988cec14..e2b1250a14081ca847f49c0b1b42f17cac30f0f5 100644 (file)
@@ -2,12 +2,12 @@
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.execTool = exports.commandExists = exports.runGoTool = exports.goBinPath = exports.installGoBin = void 0;
 const tslib_1 = require("tslib");
-const path_1 = tslib_1.__importDefault(require("path"));
-const fs_1 = tslib_1.__importDefault(require("fs"));
-const util_1 = tslib_1.__importDefault(require("util"));
+const path_1 = (0, tslib_1.__importDefault)(require("path"));
+const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
+const util_1 = (0, tslib_1.__importDefault)(require("util"));
 const child_process_1 = require("child_process");
 const coc_nvim_1 = require("coc.nvim");
-const which_1 = tslib_1.__importDefault(require("which"));
+const which_1 = (0, tslib_1.__importDefault)(require("which"));
 const config_1 = require("./config");
 const runExec = util_1.default.promisify(child_process_1.exec);
 const isWin = process.platform === 'win32';
@@ -33,13 +33,13 @@ async function installGoBin(source, force = false, getVersion) {
 exports.installGoBin = installGoBin;
 async function goBinPath(source) {
     const name = goBinName(source);
-    return path_1.default.join(await config_1.configDir('bin'), name + (isWin ? ".exe" : ""));
+    return path_1.default.join(await (0, config_1.configDir)('bin'), name + (isWin ? ".exe" : ""));
 }
 exports.goBinPath = goBinPath;
 async function runGoTool(name, args = []) {
     const bin = await goBinPath(name);
     return new Promise((resolve) => {
-        const p = child_process_1.spawn(bin, args);
+        const p = (0, child_process_1.spawn)(bin, args);
         let out = "";
         p.stdout.on('data', (data) => out += data);
         p.on("close", code => resolve([code, out]));
@@ -50,7 +50,7 @@ async function commandExists(command) {
     if (path_1.default.isAbsolute(command)) {
         return fileExists(command);
     }
-    return new Promise((resolve) => { which_1.default(command, (err) => resolve(err == null)); });
+    return new Promise((resolve) => { (0, which_1.default)(command, (err) => resolve(err == null)); });
 }
 exports.commandExists = commandExists;
 ////////////////////////////////////////////////////////////////////////////////
@@ -63,8 +63,8 @@ async function fileExists(path) {
     return new Promise((resolve) => fs_1.default.open(path, 'r', (err) => resolve(err === null)));
 }
 async function goRun(args) {
-    const gopath = await config_1.configDir('tools');
-    const gobin = await config_1.configDir('bin');
+    const gopath = await (0, config_1.configDir)('tools');
+    const gobin = await (0, config_1.configDir)('bin');
     const env = {
         GO111MODULE: 'on',
         GOBIN: gobin,
@@ -74,7 +74,7 @@ async function goRun(args) {
     };
     const cmd = isWin
         ? `go ${args}`
-        : `env GOBIN=${gobin} go ${args}`;
+        : `env GOBIN="${gobin}" go ${args}`;
     const opts = {
         env: Object.assign({}, process.env, env),
         cwd: gopath,
@@ -99,7 +99,7 @@ async function execTool(source, args, input) {
         await installGoBin(source);
     }
     return new Promise((resolve, reject) => {
-        const p = child_process_1.execFile(bin, args, { cwd: coc_nvim_1.workspace.cwd }, async (err, stdout, stderr) => {
+        const p = (0, child_process_1.execFile)(bin, args, { cwd: coc_nvim_1.workspace.cwd }, async (err, stdout, stderr) => {
             if (err && err.code === "ENOENT") {
                 return reject(`Error: Command ${name} not found! Run "CocCommand go.install.${name}" to install it and try again.`);
             }