我有一个包和许多测试文件。
web
|- client.go
|- client_test.go
|- server.go
|- server_test.go
|- ...
如果我想运行go test client_test.go,它会为我报告错误。
package web // not the package name web_test
func TestHost(t *testing.T) {
hostPort, hostNoPort := hostPortNoPort()
}
// error: undefined hostPortNoPort
// But this function actually defined in the client.go
浮云间
慕森王
相关分类