gocss <g...@curtissystemssoftware.com> wrote: > good catch .... however the thing that made it not obvious > is that is it built without the // Output: line ... > Running go test -work .... can show why it fails ... further this does make > sense too > that no such testing args should be in an 'Example' program.
Just out of curiosity, how might you use a testing.T value in an Example type test? Off the top of my head t.Log()/t.Logf() are the only things I can think of. > I think the test apparatus should fail or warn in either case. If you ran go vet -tests, It would have complained but I think its output is also a little cryptic and it doesn't appear to check for "// Output:" comments Either way, go vet would have helped you here: $ go vet -tests ex_test.go:7: ExampleNew should be niladic I also I think reading the testing docs and a careful read of the error text explains almost as clearly as go vet: > /tmp/go-build584983468/csspc/alog/_test/_testmain.go:30:22: cannot use > alog.ExampleNew (type func(*testing.T)) as type func() in field value I agree that this was probably annoying and hard to catch. I think you solved it correctly by either reading the docs or asking for help and I doubt you'll ever make this mistake again. Maybe you should also add go vet to your toolbox if it isn't already there? -ayan -- 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. For more options, visit https://groups.google.com/d/optout.