该go test命令支持该-c标志,描述如下:
-c Compile the test binary to pkg.test but do not run it.
(Where pkg is the last element of the package's import path.)
Run Code Online (Sandbox Code Playgroud)
据我所知,生成这样的二进制文件是使用GDB以交互方式运行它的方法.但是,由于测试二进制文件是通过在某些/ tmp /目录中临时组合源文件和测试文件来创建的,所以当我list在gdb中运行时会发生这种情况:
Loading Go Runtime support.
(gdb) list
42 github.com/<username>/<project>/_test/_testmain.go: No such file or directory.
Run Code Online (Sandbox Code Playgroud)
这意味着我不能像以前那样愉快地检查GDB中的Go源代码.我知道可以通过将-work标志传递给go test命令来强制临时目录保留,但是由于二进制文件不是在该目录中创建的,因此仍然是一个巨大的麻烦.我想知道是否有人找到了解决这个问题的干净方案.
对于提交的所有文件,我希望状态修饰符--name-status提供,以及提供的添加和删除行的数量--numstat.说我有以下内容:
> git log --pretty=format:"%aN %ct" --reverse --name-status --encoding=UTF-8 --no-renames
John Doe 1234567489
M foo/bar/foo.bar
A bar/hello.txt
Run Code Online (Sandbox Code Playgroud)
和:
> git log --pretty=format: --reverse --numstat --encoding=UTF-8 --no-renames
9 5 foo/bar/foo.bar
21 0 bar/hello.txt
Run Code Online (Sandbox Code Playgroud)
是否有单个命令/标志组合可以将它们的输出组合在一起?有点像这样:
John Doe 1234567489
M 9 5 foo/bar/foo.bar
A 21 0 bar/hello.txt
Run Code Online (Sandbox Code Playgroud)
我知道可以将它们与一些awk魔法结合起来,但是看到我将在多个大型存储库和性能问题上执行此操作,单个git log命令将更可取.