Re:Go's power is in emergent behavior
by helper on Saturday April 26, 2014 @10:14PM
(#7653625)
Your example of `foo.go` and `foo_test.go` would actually work the way you want. In go, tests are in the same namespace as the code they are testing so they have access to private members.
[ Parent
| on HN ]
Ah, thank you. Where i was going wrong was declaring `foo_test.go` to be a separate package from `foo.go`. When i write `package foo` at the head of both `foo.go` and `foo_test.go` this works fine.