我正在尝试编写一个自动任务来帮助我构建go插件。任务如下所示
{
"label": "compile wc.go",
"type": "shell",
"command": "go",
"args": [
"build",
"-buildmode=plugin",
"-gcflags='all=-N -l'",
"../mrapps/wc.go"
],
"options": {
"cwd": "${workspaceFolder}/src/main",
}
}
当我运行它时,终端显示以下错误:
> Executing task: go build -buildmode=plugin -gcflags='all=-N -l' ../mrapps/wc.go <
/bin/bash: go: command not found
The terminal process "/bin/bash '-c', 'go build -buildmode=plugin -gcflags='all=-N -l' ../mrapps/wc.go'" failed to launch (exit code: 127).
当我运行它时,命令go env在集成终端上完美运行
(base) XIEs-MacBook-Pro:6.824 j$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
...enter code here
我一直在寻找答案,但没有。
我尝试了另一个任务
{
"label": "test",
"type": "shell",
"command": "echo $PATH",
"options": {
"cwd": "${workspaceFolder}/src/main"
}
}
它打印了我的PATH,这与我在bash或集成终端中获得的PATH明显不同。
我还尝试按任务打开python解释器,这会产生python 2.7,绝对不是默认的(python)。
慕的地8271018
慕沐林林
相关分类