-
Notifications
You must be signed in to change notification settings - Fork 646
vscode-go doesn't work well with symlinked directroy #846
Comments
I can repro! (finally) Had to tweak some of your repro steps though.
I can see the errors in VS Code, but building in the terminal is successful. Looks like the process that is spawned to run Anybody having any ideas is appreciated. |
Can you try |
Turns out command line and newly spawned process resolve Phew This was a cool problem to figure out, thanks for reporting @bruceauyeung! |
The latest update (0.6.56) to the Go extension has the fix to this issue. |
@ramya-rao-a I'm having a similar issue: I am a kubernetes developer(and thanks to vs-code which makes debugging extremely convenient), when I navigate to Running tool: /usr/local/bin/go test -timeout 30s -tags -run ^TestScheme$
can't load package: package k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/runtime: code in directory /Users/haibzhou/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/runtime expects import "k8s.io/apimachinery/pkg/runtime"
Error: Tests failed. And when I check in console: $ go test k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime
ok k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime 0.049s
$ go test k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/runtime
can't load package: package k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/runtime: code in directory /Users/haibzhou/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/runtime expects import "k8s.io/apimachinery/pkg/runtime" I am using vscode-go at version 0.6.63 by the way. Adding a customized config does not work either: {
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceRoot}/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go",
"env": {},
"args": [
"-test.run=TestScheme"
],
"showLog": true
}
]
} |
@zhouhaibing089 In the latest update to the Go extension, you should be able to run and debug tests in symlinked environments. Thanks for the fix! |
reproduce steps:
mkdir $HOME/heapster-build/src/k8s.io/ -p
mkdir /tmp/heapster/ -p && cd /tmp/heapster/ && git clone https://github.com/kubernetes/heapster.git
cd $HOME/heapster-build/src/k8s.io/ && ln -s mkdir /tmp/heapster/
export GOPATH=$HOME/heapster-build && code $HOME/heapster-build
$HOME/heapster-build/src/k8s.io/heapster/metrics/heapster.go
and vscode-go will complain packages such ask8s.io/apimachinery/pkg/fields
can not be found, but actually they are in the vendor directory.cd $HOME/heapster-build/src/k8s.io/heapster/metrics
, and then rungo build heapster.go auth.go handlers.go
, this can build successfully.if i copy
/tmp/heapster/ to
$HOME/heapster-build/src/k8s.io` instead of making a symlink , vscode-go works wellvscode:1.10.1
vscode-go:0.6.55
os:Ubuntu 16.04.1 LTS
The text was updated successfully, but these errors were encountered: