13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/scripts/go/test.rb', line 13
def run
go_test_package = env_fetch("GO_TEST_PACKAGE", ".")
go_coverage_output = env_fetch("GO_COVERAGE_OUTPUT", "./coverage.txt")
output = capture_command("sh", "-c", "go list #{go_test_package}/... | grep -v vendor")
packages = output.split("\n")
cover_output = ""
packages.each do |package|
output_file = Tempfile.new('go test')
command("go", "test", "-v", "-race", "-coverprofile=#{output_file.path}", "-covermode=atomic", package)
cover_output += output_file.read
output_file.close
output_file.unlink
end
File.write(go_coverage_output, cover_output)
end
|