cmd/go: go test -cover & go test -coverprofile should always output a coverage #24570 • ΧόϨοδϨϙʔτͷग़ྗํࣜʹ͍ͭͯվળͷ༨͋Γͱ͍͏ • ٞࣗମ2018/03/18͔Β • ࣌go1.10࣌ • Go 1.10 Release Notes • ςετ݁ՌΛΩϟογϡ͢Δ • ҰʹෳύοέʔδͷΧόϨοδ͕औΕΔ ←͜͜ ىථ࣌ͷഎܠ
• ઐ༻ͷநग़εΫϦϓτ͔ΒߜΓࠐΉ • *_test.go͕͋ΔσΟϨΫτϦ͕ରͱ͢Εࣗಈ ੜܥר͖ࠐ·Εͳ͍ • ϝϦοτ • جຊతʹैདྷ௨ΓͷڍಈʹͰ͖Δ • σϝϦοτ • ίʔυશମͷ࣭ΛଌΔ͏͑ͰӅṭ͞ΕΔ #!/bin/bash # ݱࡏͷσΟϨΫτϦ͔Βͯ͢ͷGoύοέʔδΛݕࡧ for pkg in $(go list ./...); do # ֤ύοέʔδͷσΟϨΫτϦΛऔಘ pkg_dir=$(go list -f '{{.Dir}}' $pkg) # *_test.goϑΝΠϧ͕ͦͷσΟϨΫτϦʹଘࡏ͢Δ͔֬ೝ if [[ $(ls $pkg_dir/*_test.go 2> /dev/null) ]]; then # ଘࡏ͢Δ߹ύοέʔδ໊Λදࣔ echo $pkg fi done go test -cover $(./listup_test_pkg.sh)