我正在嘗試編寫一個自動任務來幫助我構建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 foundThe 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 envGO111MODULE=""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)。
2 回答

慕的地8271018
TA貢獻1796條經驗 獲得超4個贊
您可能應該設置,以便導出 中的所有變量。AFAIK這里是設置。Run as login shell
bash_profile(rc)
"terminal.integrated.shellArgs.osx": ["-l"]

慕沐林林
TA貢獻2016條經驗 獲得超9個贊
嘗試設置為 @Зелёный 建議,或者您也可以設置為 指向 .terminal.integrated.shellArgs.osx
terminal.integrated.automationShell.osx
/bin/bash
- 2 回答
- 0 關注
- 170 瀏覽
添加回答
舉報
0/150
提交
取消