When I run a test in Go, is there any way for me to get the list of files that the code imports, directly or indirectly? For example, this could help me rule out changes from certain parts of the codebase when debugging a failing test.
Alternatively, with Git, can we find out what the lowest common ancestor git tree node is for the files exercised in a given test?
Context: I'm looking into automated flakiness detection for my test suite, and I want to be able to know the dependency tree for every test so that I can detect flaky tests better.
For example, if TestX
fails for version x
of the code, and later on some files in the same codebase which are not used at all by TestX
are changed, and then TestX
passes, I want to be able to detect that this is a flaky test, even though the overall codebase that the test suite ran on has changed.