Commentf returns an infomational value to use with Assert or Check calls. If the checker test fails, the provided arguments will be passed to fmt.Sprintf, and will be presented next to the logged failure.

For example:

c.Assert(v, Equals, 42, Commentf("Iteration #%d failed.", i))

Note that if the comment is constant, a better option is to simply use a normal comment right above or next to the line, as it will also get printed with any errors:

c.Assert(l, Equals, 8192) // Ensure buffer size is correct (bug #123)

Commentf is referenced in 0 repositories