Is there a particular reason you want 100% code coverage? Not trying to start a flame war: given limited time and effort, unless the rest of my projects had 100% coverage already, I would personally spend my time working with a package with lower coverage, or just fixing known bugs. If your codebase has no bugs and otherwise full coverage... I have to say I'm jealous :)
In any case, one way to test your application's handling of an error from that function is to fake it out during unit tests (simple example, let me know if you want a more thorough one: https://play.golang.org/p/uKGFLYVlQxz). Of course this does not test the "integration" of your application code and ioutil.ReadDir, but IMHO trying to get extremely high code coverage in non-unit tests is really a time sink. -- 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/1908d64d-fb3f-4d73-9302-b215c49dac36%40googlegroups.com.