我正在嘗試編寫一個自動任務(wù)來幫助我構(gòu)建 go 插件。任務(wù)看起來像這樣 { "label": "compile wc.go", "type": "shell", "command": "go", "args": [ "build", "-buildmode=plugin", "-gcflags='all=-N -l'", "../mrapps/wc.go" ], "options": { "cwd": "${workspaceFolder}/src/main", } }當(dāng)我運行它時,終端顯示以下錯誤:> Executing task: go build -buildmode=plugin -gcflags='all=-N -l' ../mrapps/wc.go </bin/bash: go: command not foundThe terminal process "/bin/bash '-c', 'go build -buildmode=plugin -gcflags='all=-N -l' ../mrapps/wc.go'" failed to launch (exit code: 127).當(dāng)我運行 go env 命令時,它可以在集成終端上完美運行(base) XIEs-MacBook-Pro:6.824 j$ go envGO111MODULE=""GOARCH="amd64"GOBIN=""...enter code here我一直在尋找答案,但沒有。我嘗試了另一個任務(wù) { "label": "test", "type": "shell", "command": "echo $PATH", "options": { "cwd": "${workspaceFolder}/src/main" } }它打印了我的 PATH,這與我在 bash 或集成終端中得到的明顯不同。而且我還嘗試按任務(wù)打開一個python解釋器,它產(chǎn)生一個python 2.7,肯定不是默認(rèn)的(由哪個python)。
2 回答

一只甜甜圈
TA貢獻(xiàn)1836條經(jīng)驗 獲得超5個贊
您可能應(yīng)該設(shè)置以便導(dǎo)出Run as login shell
中的所有變量。bash_profile(rc)
AFAIK 這里是設(shè)置"terminal.integrated.shellArgs.osx": ["-l"]
。

BIG陽
TA貢獻(xiàn)1859條經(jīng)驗 獲得超6個贊
嘗試設(shè)置terminal.integrated.shellArgs.osx
為@Зелёный 建議,或者您也可以設(shè)置terminal.integrated.automationShell.osx
為指向/bin/bash
.
- 2 回答
- 0 關(guān)注
- 204 瀏覽
添加回答
舉報
0/150
提交
取消