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

推荐工具 go-diff

  •  1
     
  •   loushizan · 2021-11-24 16:45:28 +08:00 · 2313 次点击
    这是一个创建于 855 天前的主题,其中的信息可能已经有所发展或是发生改变。

    声明

    非作者,纯推荐

    背景

    最近有个优化 CI 测试速度的需求,目前 CI 是全量跑项目下所有 packages 的 test ,量大且慢

    想的方案是找出一个 GitHub PR 代码改动涉及的 packages 以及相关连的 packages

    结果

    随后面向 Google 一番努力编程💪,成功找到 go-diff

    完全满足我的需求

    基本用法

    # file 协议
    go-diff -repo file://[git_repo_path] -from [from_commit_hash] -to [to_commit_hash]
    # git/https 协议
    go-diff -repo [git_repo_url] -branch [branch_name] -from [from_commit_hash] -to [to_commit_hash]
    

    工具对比了 2 个 commit 之间的代码改动涉及的 packages ,并打印到 stdout

    更详细的用法就去看 README 或者源码

    这次参数都可以在 GitHub PR 内找到,具体看大家用的 CI 系统是什么

    希望能帮助到需要的人🙏

    2 条回复    2021-11-24 18:03:18 +08:00
    11373450
        1
    11373450  
       2021-11-24 18:00:47 +08:00
    可以试试看。我们现在的 ci 测试太久了都
    retanoj
        2
    retanoj  
       2021-11-24 18:03:18 +08:00   ❤️ 1
    额。。看两个 hash 的 diff
    git diff 不可以满足 LZ 的要求吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1065 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:11 · PVG 03:11 · LAX 12:11 · JFK 15:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.