problem description
configuration in go-task
{
"label": "Go-Build",
"type": "shell",
"command": "go",
"args": [
"build",
"${file}"
],
"group":{
"kind":"build",
"isDefault":true
}
}
the platform version of the problem and what methods you have tried
The problem withis that the package can be found when debugger, and the launch.json in the project will be found according to go.inferGoPath, but why can"t Bonnie be found in the set task?
think of yourself
taskshell,,go.inferGoPathGOPATH.
solution
-
set the GOPATH path to the current workSpace in task.
I don"t know why the following has no effect
"options": {"env": { "${GOPATH}":"${workSpace}" }
}
- set the GOPATH environment variable to two paths: the first is the workSpace in the current VSC, so that when go-get or a third-party library is imported, it will be downloaded to the current workSpace, and the second is the default path: ~ / go; at the same time, set go.toolsGoPath to ~ / path-to-tools so that goTools will not be downloaded repeatedly
do you have a better way, or a way?