in my case, the owner of ~/go/pkg/mod has changed to root for some reason, probably from homebrew, use chown -R yourname ~/go/pkg/mod will change them back to your user then all installation in vscode succeed.
chown -R yourname ~/go/pkg/mod