36

如何使用GoLand调试beego项目

 5 years ago
source link: https://studygolang.com/articles/18426?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

title: 如何使用GoLand调试beego项目

前言

beego是一个快速开发 Go 应用的 HTTP 框架,他可以用来快速开发 API、Web 及后端服务等各种应用,是一个 RESTful 的框架。

GoLand是一个用于开发go应用的IDE,和python常用的IDE pyCharm一样,都是由JetBrains公司开发的。

最近看了下使用go开发web应用方面的东西,发现beego(https://github.com/astaxie/beego) 这个框架挺不错的,中文的文档写的也很好 (https://beego.me/docs/intro/)。 我按照文档把demo run起来了,然后就是想着怎么debug了,下面简单介绍下如何使用GoLand这个IDE来debug beego应用。

开始调试

这里假设你已经安装好了go和beego环境。可以参考https://beego.me/docs/install/进行安装。

1、准备beego项目

参考上面发的文档连接准备一个beego项目。

2、配置GoLand

2.1、使用GoLand打开准备好的beego项目

菜单栏依次选择:"File" -> "Open",选择beego路径,然后“确定”,我的demo路径为“D:\dyp\project\go\ceshi\src\quickstart”,如下图所示:

IFjQnen.png!web

2.2、编辑configurations

菜单依次选择“Run”->“Edit configurations”如下图所示:

yiiaAjF.png!web

在弹出的对话框中按照如下图所示配置:

ru2Iv2N.png!web

2.3、开始调试

点击“debug”按钮,如下图所示:

J3EvyqF.png!web

设置断点就可以开始调试啦。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK