Create a gist now

Instantly share code, notes, and snippets.

@atotto /eg.go
Last active Dec 11, 2015

What would you like to do?
package eg
func foo() string {
return "foo"
}
func Bar() string {
return "Bar"
}
package eg_test
import (
. "."
"testing"
)
func TestFunc(t *testing.T) {
result := Foo()
if result != "foo" {
t.Errorf("result = %v, want %v", result, "foo")
}
}
package eg_test
import (
"."
"fmt"
)
func ExampleCall() {
fmt.Println(eg.Bar())
}
package eg
var Foo = foo

golang package example with testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment