I have a Go 1.14 project with the following directory structure:
myapp/
server/
payments/
capture_payment.go
capture_payment_test.go
billing/
billing.go
billing_test.go
fulfillment/
fulfillment.go
fulfillment_test.go
In my billing.go
file I have:
package billing
import (
"fmt"
)
func Flim() {
fmt.Println("FLIM")
}
In my fulfillment_test.go
file I have:
package fulfillment
import (
"fmt"
)
func Flam() {
fmt.Println("FLAM")
}
In my capture_payment_test.go
file I have:
package payments
import (
"testing"
"github.com/myorg/myapp/billing"
"github.com/myorg/myapp/fulfillment"
)
func TestSomething(t *testing.T) {
billing.Flim()
fulfillment.Flam()
}
When I cd
into server/payments
and run go test
I get the following error:
$ go test
# github.com/myorg/myapp/server/payments [github.com/myorg/myapp/server/payment.test]
./capture_payment_test.go:12:2: undefined: fulfillment.Flam
FAIL github.com/myorg/myapp/server/payments [build failed]
Can anyone spot why fulfillment.Flam()
is undefined, but billing.Flim()
is perfectly fine?