Everything was working fine until I added a dependency of a private repository. I noticed that autocomplete stopped working and there was an error notification by vscode:
Error loading workspace: err: exit status 1: stderr: go:
bitbucket.org/my-group/my-private-repo@v0.0.0-20210512194559-2c29669c4ecc:
reading https://api.bitbucket.org/2.0/repositories/my-group/my-private-repo?fields=scm:
403 Forbidden server response: Access denied. You must have write or admin access.
go: bitbucket.org/my-group/my-private-repo@v0.0.0-20210512194559-2c29669c4ecc:
reading https://api.bitbucket.org/2.0/repositories/my-group/my-private-repo?fields=scm:
403 Forbidden server response: Access denied. You must have write or admin access.
: packages.Load error
It seems like the go extension is trying to access my private repo:
[url "git@bitbucket.org:"]
insteadOf = https://bitbucket.org/
Your private key should be used automatically, assuming you don't require any special config for normal git over ssh operations.