V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
kdbtg91
V2EX  ›  Go 编程语言

Go 项目的调试、测试

  •  
  •   kdbtg91 · 17 天前 · 2114 次点击

    关于 Go 语言的调试,测试的一些常见方法,巧妙的技巧,各位有没有什么博客文章,视频或者书籍之类的推荐一下。 或者推荐一些库或者框架也行。感谢。

    第 1 条附言  ·  14 天前
    感谢各位,我把一些链接放在后面:

    关于基准测试 https://geektutu.com/post/hpg-benchmark.html

    [Go Test 单元测试简明教程 \| 快速入门 \| 极客兔兔]( https://geektutu.com/post/quick-go-test.html)

    分布式调试[Debugging by Pretty Printing]( https://blog.josejg.com/debugging-pretty/)

    [debugging · golang/vscode\-go Wiki]( https://github.com/golang/vscode-go/wiki/debugging)

    库:

    [uber\-go/mock: GoMock is a mocking framework for the Go programming language\.]( https://github.com/uber-go/mock)

    [stretchr/testify: A toolkit with common assertions and mocks that plays nicely with the standard library]( https://github.com/stretchr/testify)

    [pingcap/go\-ycsb: A Go port of Yahoo\! Cloud Serving Benchmark \(YCSB\)]( https://github.com/pingcap/go-ycsb)





    [dlv 命令行的远程调试 golang 进程步骤\(包含容器进程\) · zhangguanzhang's Blog](
    7 条回复    2024-10-17 09:46:36 +08:00
    gvison
        2
    gvison  
       17 天前
    现代负载测试工具 k6 https://github.com/grafana/k6
    支持生成测试代码、性能压测代码、swagger 文档的开发框架 https://github.com/zhufuyi/sponge
    cooltechbs
        3
    cooltechbs  
       17 天前 via Android
    支持一楼,testify 我用了好几年了。
    我有的同事用 goconvey ,但我一直难以习惯它的语法
    guanzhangzhang
        5
    guanzhangzhang  
       15 天前
    调试的话先学会 dlv,https://zhangguanzhang.github.io/2021/07/20/dlv-remote/
    vscode 里就是 dlv ,go install 下就行,如果 main 不在项目根路径下,先文件聚焦到 main 文件,再点 vscode 的调试按钮
    单元测试这个的话可以找一些小函数用最常见的 testify 之类写下,入门了后再去看网络和 http 的 mock 之类的
    xhd2015
        6
    xhd2015  
       5 天前 via iPhone
    sophos
        7
    sophos  
       4 天前
    要真正做好调试和测试,项目大了之后,依赖注入是不可避免的
    可以选择手动管理依赖项和注入逻辑,也可以基于框架实现自动管理,类比 spring 之于 java 吧

    https://github.com/go-kod/kod
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   982 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:45 · PVG 04:45 · LAX 13:45 · JFK 16:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.