1
votes

Using go go1.10.2 darwin/amd64 together with glide 0.13.1. Dependencies are in the vendor directory. There is no error building from the command line. When viewing the code in VS Code, the following error is displayed:

Cannot find package "github.com/xxx/go-utility/log" in any of:

/usr/local/Cellar/go/1.10.2/libexec/src/github.com/xxx/go-utility/log (from $GOROOT) /Users/martin/go/src/github.com/xxx/go-utility/log (from $GOPATH)

Both the terminal and the VS Console report GOPATH="/Users/martin/go"

I expect that I can make the message go away if I issue a go get, but this defeats the purpose of the vendor directory.

This is a new installation on a new computer.

What configuration have I forgotten?

1
Where are your project code and the vendor directory located?JimB
/Users/martin/go/src/xxxdc.visualstudio.com/enlightcentre/reports/backendMartin Flower
/Users/martin/go/src/xxxdc.visualstudio.com/enlightcentre/reports/backend/vendor/github.com/xxx/go-utilityMartin Flower
That looks correct at first glance, are you sure there's no symlinks in that path? (you can quickly check from the project directory with pwd -P, which should match the paths above exactly)?JimB
yes, there are symlinks in the pathMartin Flower

1 Answers

2
votes

As reported on vscode-go github issue 1587 my solution was to add the following to user settings (Code > Preferences > Settings)

{ "search.useIgnoreFiles": false }