vendredi 27 mars 2015

golang example won't run

I'm trying to add an example to a package, and run the example via go test, however the example is never run.


For example, see this gist: http://ift.tt/1EKIy3K


The gist has example_test.go:



package cow_test

import (
cow "http://ift.tt/1EKIy3M"
)

func Example() {
cow.Poke()
}


Yet when I run this:



# go test -v example_test.go
testing: warning: no tests to run
PASS
ok command-line-arguments 0.002s


However other packages from stdlib work just fine:



# cd /usr/lib/go/src/errors
# go test -v example_test.go
=== RUN: Example
--- PASS: Example (0.00s)
PASS
ok command-line-arguments 0.002s


What is wrong with my example?


Aucun commentaire:

Enregistrer un commentaire