Hi all, I'm looking for a good study/quantitative measure of how well-written Go code looks compared to other languages, such as Java, when it comes to test coverage. In particular, how handling errors may reduce the percentage of code covered by tests in Go relative to other languages.
For example, in this code snippet: func Foo() error { // do some stuff that actually adds value if err := somelib.Bar(); err != nil { // triggering the error case in Bar is hard, i.e. requires simulating network troubles // or causing a file write to fail, but we don't do anything with result besides // return it. Testing it by adding an interface or wrapper isn't worth the effort // and the only impact is really reported test coverage. return err } // do more stuff return nil } In Java, you would just add 'throws SomeException' to your method declaration. The effect is that we have one line in the Go code which is not easily covered by a test, whereas Java does not report that untested case because the return path is not visible in the code. The result is that otherwise equivalent code, we will report different code coverage values, with Go being slightly lower. I'm just looking for something written on that topic that can give us a notion of how much of a difference we might expect. Thanks, Charles -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6b48ed73-1963-482e-aff0-b91f3aa6a2aen%40googlegroups.com.