Home >Backend Development >Golang >Solve the problem that Go cannot be debugged after upgrading to 1.14

Solve the problem that Go cannot be debugged after upgrading to 1.14

咔咔
咔咔Original
2020-07-14 17:27:252793browse

Debug is so important to a programmer, but after upgrading go1.14, my debug can no longer be used, which is very embarrassing. Encountered Problem solving problem.

It is estimated that most people will encounter this problem in the future. Kaka has always insisted on using the latest version during the learning process.

Searching based on Kaka's current title, there are only a few articles analyzing it, but I couldn't implement the solution they gave me, so Kaka published an article to analyze this problem.

The most common solution is go get -u github.com/derekparker/delve/cmd/dlvExecute this command. I don’t know why this command is not executed here. As a result, it is not downloaded, and the command ends after a while.

Solve this problem generously

This problem is because this delve is not installed in version 1.14

Kaka is operated in windows, and the editor used is Goland.

Kaka’s GOROOT is in C:Go. If the picture provided by Kaka is missing any directory, please fill it in yourself

Just create the folders github.com/go-develSolve the problem that Go cannot be debugged after upgrading to 1.14Then execute under the go-devel foldergit clone https://github.com/derekparker/delve.gitSolve the problem that Go cannot be debugged after upgrading to 1.14After downloading, the following files will appear, and they are all in the delve folderSolve the problem that Go cannot be debugged after upgrading to 1.14Finally we need to use go install to install our package

Execute the commandgo install github. com/go-delve/delve/cmd/dlvHere you need to see the directory structure clearly

After executing the command, a dlv executable program will be generated under GOPATH/bin. If there is no such file The installation fails. Look back and see where the operation is different from Kaka. Solve the problem that Go cannot be debugged after upgrading to 1.14Open the Goland editor, click according to the arrow prompt given by Kaka, then a create will pop up, click itSolve the problem that Go cannot be debugged after upgrading to 1.14Then enter the following contentdlv.path=C:/Go/bin/dlv .exe is the executable program just installedSolve the problem that Go cannot be debugged after upgrading to 1.14At this point all the work has been completed. Restart our Goland and take a look at the break point.

Go’s breakpoints still look very comfortable and very nice. This problem is perfectly solvedSolve the problem that Go cannot be debugged after upgrading to 1.14

Persistence in learning, persistence in blogging, and persistence in sharing are the beliefs that Kaka has always upheld since his career. I hope that Kaka’s articles in Nuoda Internet can bring you a little bit of help .

The above is the detailed content of Solve the problem that Go cannot be debugged after upgrading to 1.14. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn