使用Visual Studio Code调试Go代码

This article will go over how to debug your Go code, so it goes without saying that a prerequisite for this article is that you understand the basics of writing Go.

本文将介绍如何调试Go代码,因此无需多说,本文的前提条件是您了解编写Go的基础知识。

If you do not have experience writing Go, and would like to learn, we recommend that you check out A Tour of Go to start your Go journey.

如果您没有编写Go语言的经验,并且想学习,我们建议您查看A Go of Go语言以开始Go语言之旅。

建立 (Setup)

You need have the following requirements met:

您需要满足以下要求:

  1. You know enough about Go to write a small program, or even a small http server.

    您对Go足够了解,可以编写一个小程序,甚至是一个小型http服务器。
  2. You have go installed in your machine and the environment variable $GOPATH is set. (It defaults to ~/go)

    您已经安装了计算机,并设置了环境变量$ GOPATH。 (默认为〜/ go)
  3. The path $GOPATH/bin is exposed to your PATH.

    $GOPATH/bin路径公开给您的PATH。

  4. You have Visual Studio Code installed.

    您已经安装了Visual Studio Code。
  5. You have the VSCode-Go plugin installed.

    您已经安装了VSCode-Go插件

Once you have this installed, when open any .go files in VSCode, you will be prompted on the bottom right of the status bar to Install Analysis Tools. Click on that link to install the necessary Go packages for the plugin to work efficiently.

一旦你安装了这个,当打开任何.go在VSCode文件,你会在状态栏的右下角提示Install Analysis Tools 。 单击该链接以安装必要的Go软件包,以使插件有效地工作。

We finally need to install Delve, an open-source debugger for Go. To do this, there are detailed installation instructions for specific platforms.

最后,我们需要安装Delve ,这是Go的开源调试器。 为此,有针对特定平台的详细安装说明

创建示例应用 (Creating a Sample App

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值