【发布时间】:2013-02-06 06:49:42
【问题描述】:
目录结构为:
src
src/pkg
src/pkg/t1.go
src/pkg/t1_test.go
t1.go
package pkg
import (
"fmt"
)
func SayHI(){
fmt.Println("this is t1")
}
t1_test.go
package pkg
import (
"testing"
)
func TestXYZ(t *testing.T) {
SayHI()
}
从 dir src/pkg 的命令行调用 go test
go test t1_test.go
错误:
./t1_test.go:8: undefined: SayHI
FAIL command-line-arguments [build failed]
但功能在那里
感谢任何提示
【问题讨论】:
-
如果你只在你的包中运行“go test”,没有文件名会发生什么?
-
请花时间正确格式化您的问题。见“How do I format my posts...”“How do I format my code blocks?”
标签: go