I am having an issue with the built in testing for go lang.
I keep getting this error.
> go test
> can't load package: package .: found packages main (calculator.go) and calculator (calculator_test.go) in
calculator.go
package main
func main() {
}
calculator_test.go
package calculator
import "testing"
func TestAdd(t *testing.T) {
result := Add(1, 3)
if result != 4 {
t.Fail()
}
}
You have
package main
func main() {}
in file calculator.go
.
and
package calculator
in file calculator_test.go
.
They should both be
package main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With