Are you able to install delve outside VSCode? That is, does the following command succeed:
go install github.com/go-delve/delve/cmd/dlv@latest
If this works, then there is perhaps something wrong with the VSCode setup.
Do other Go tools install fine thorugh VSCode?
What command do you use to trigger Delve installation in VSCode?
I am totally new in the programming field and the reason why I am learning Go is to design smart contracts for a blockchain. My background is civil engineering.
Your suggested command was pasted on CMD and bash and the output was:go\pkg\mod\github.com\spf13\pflag@v0.0.0-20170417173400-9e4c21054fa1\hello.go:1:1: expected ‘package’, found hello. Does this mean the command has succeeded?
The other Go tools were successfully installed on VSCode except the Dlv and dlv-app.
The command I used to trigger dlv installation in VSCode was Go install/update tools.
BTW, I have uninstalled and reinstalled VSCode 3 time and the issue just persisted.
Thank you for your time and I look forward to your reply.
The message you get is an error message. However, this message does not seem to make much sense to me.
The output shows an issue with package spf13/pflag. The message indicates that the source file “hello.go” is malformed.
The interesting part here is that the pflag package contains no file named “hello.go” at all.
The path in this message points to a local file: go\pkg\mod\ is the standard place where downloaded packages are cached.
You might try cleaning the module cache:
go clean -modcache
This removes all local files that were created from downloading and compiling third-party modules. (No worries, the cache will build up again with every go install, go mod tidy, go mod download, go get or similar commands.)
The idea here is that if some file in the cache is damaged, then re-downloading might fix the problem.
After cleaning the module cache, try installing dlv again:
go install github.com/go-delve/delve/cmd/dlv@latest
If this succeeds, then retry “Go: install/update tools” in VSCode.