5

大家 go 都是怎么调试, 每次修改都要在 goland 上, go debug main, 真麻烦

 1 year ago
source link: https://www.v2ex.com/t/919501
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.
neoserver,ios ssh client

大家 go 都是怎么调试, 每次修改都要在 goland 上, go debug main, 真麻烦

V2EX  ›  Go 编程语言

大家 go 都是怎么调试, 每次修改都要在 goland 上, go debug main, 真麻烦

  zhuchuanjun · 3 小时 6 分钟前 · 1048 次点击
  1. 用 goland 上 debug 调试, 但是每次修改, 都要重新 debug
  2. 用 air 热加载, 但是不能 debug

有没有啥两全其美的方法, 又能 debug, 又能热加载

15 条回复    2023-02-27 16:06:30 +08:00
fiypig

fiypig      3 小时 5 分钟前

vscode 断点
zhuchuanjun

zhuchuanjun      3 小时 3 分钟前

@fiypig #1 vscode 又能 debug, 又能热加载?
chenguang0703

chenguang0703      2 小时 45 分钟前   ❤️ 1

写单元测试阶段性调试代码,这样即使不用热加载也非常快,单元测试基本通过后,再通过继承测试入口调试主流程逻辑。
maggch97

maggch97      2 小时 43 分钟前

写的时候不要老是调试
dx3759

dx3759      2 小时 41 分钟前

写单元测试方法,打断点,跑测试数据集
feedcode

feedcode      2 小时 38 分钟前

可以试下 air + dlv, remote debugging

# .air.toml
```
[build]
full_bin = "dlv exec --accept-multiclient --log --headless --continue --listen :2345 --api-version 2 the-progarm"

```
quxuanxuan

quxuanxuan      2 小时 35 分钟前

log.Debugf("xxx")
Hanggi

Hanggi      2 小时 22 分钟前

从来没用过 debug 功能。。。

go 语言编译那么快,终端跑个单元测试不就好了吗?
BeautifulSoap

BeautifulSoap      2 小时 17 分钟前

正经项目的话认真写单元测试,然后 goland 里面对单元测试的 case 进行 debug 呀
xlongye

xlongye      2 小时 13 分钟前

vscode + air, 前端一般的调试
snowlyg

snowlyg      1 小时 56 分钟前

基本不调试,go 难的问题是 并发中的问题 。普通问题单元测试就够了
airplayxcom

airplayxcom      1 小时 55 分钟前

盲猜动态语言转过来的
Goat121

Goat121      1 小时 9 分钟前

这... 我第一次见有人说 go 麻烦,不管用啥方法已经很快了呀
build 一次半小时的 C++,和 10 分钟的 java 你见过没😂
icy37785

icy37785      58 分钟前 via iPhone

写好测试比 debug 实在多了
tbwisk

tbwisk      46 分钟前

把功能拆分得足够细,单元测试通过后 再结合在一起 就比较容易通过了。

关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   广告投放   ·   实用小工具   ·   3992 人在线   最高记录 5556   ·  

创意工作者们的社区

World is powered by solitude

VERSION: 3.9.8.5 · 33ms · UTC 08:52 · PVG 16:52 · LAX 00:52 · JFK 03:52
Developed with CodeLauncher
♥ Do have faith in what you're doing.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK