Dlv and dlv-app tools failed

Hello Everyone,

I am unable to have dlv and dlv-app tools successfully installed on VS Code. The output shows the following:
2 tools failed to install.

dlv: failed to install dlv(github.com/go-
go get: added github.com/go-delve/delve v1.6.2-0.20210706162853-c617ed8189a9

Could someone advise me on how I can get those tools successfully installed?

OS: Windows 10
Go version: 1.16.5

Best regards,

Hi @Mahir_Msawil, welcome to the forum.

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?

Thank you @christophberger for your reply!

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.

@christophberger your suggested solution has just solved the issue.

Thank you very much.

Best regards,

Glad to hear that! Good luck with your project.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.