Skip to content

Instantly share code, notes, and snippets.

@atotto
Last active December 11, 2015 07:58
Show Gist options
  • Save atotto/4570162 to your computer and use it in GitHub Desktop.
Save atotto/4570162 to your computer and use it in GitHub Desktop.
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