Сбой команды 'go install ckage' с кодом выхода 1 - PullRequest
0 голосов
/ 07 октября 2018

Я пытаюсь настроить задачу gulp watch, но в результате возникла ошибка при установке одного пакета.Но я очень подозреваю, что это произошло потому, что stripPath не функционировал так, как предполагалось.

Вот журнал ошибок:

[21:20:27] Using gulpfile ~/Documents/Projects/GoLang/src/github.com/idiotLeon/TutorialBuildingDistributedApplicationsWithGo/gulpfile.js
[21:20:27] Starting 'watch'...
[21:20:27] Finished 'watch' after 8.52 ms
[21:20:33] Starting 'compilepkg'...
can't load package: package ckage: cannot find package "ckage" in any of:
    /usr/local/Cellar/go/1.11/libexec/src/ckage (from $GOROOT)
    /Users/Leon/Documents/Projects/GoLang/src/ckage (from $GOPATH)
[21:20:33] 'compilepkg' errored after 58 ms
[21:20:33] Error in plugin "gulp-shell"
Message:
    Command `go install ckage` failed with exit code 1

Вот код:gulp.js

var gulp = require('gulp');
var path = require('path');
var shell = require('gulp-shell');

var goPath = 'mypackage/*.go';

gulp.task('compilepkg', function () {
    return gulp.src(goPath, { read: false })
        .pipe(shell(['go install <%= stripPath(file.path) %>'],
            {
                templateData: {
                    stripPath: function (filePath) {
                        var subPath = filePath.substring(process.cwd().length + 5);
                        var pkg = subPath.substring(0, subPath.lastIndexOf(path.sep));
                        return pkg;
                    }
                }
            })
        );
});

gulp.task('watch', function () {
    gulp.watch(goPath, ['compilepkg']);
});

Вот репо (github) , и эта проблема возникла при самом первом коммите.

Дополнительные сведения:

go version go1.11 darwin/amd64

node -v: v10.10.0

package.json

{
  "name": "tutorialbuildingdistributedapplicationswithgo",
  "version": "1.0.0",
  "description": "",
  "main": "main.go",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-shell": "^0.6.5",
    "path": "^0.12.7"
  }
}
...