[Go] go test单元测试执行指定测试函数

go test 可以执行单元测试 , 一般把所有go文件测试单元都执行一遍

现在如果想要执行某一个指定的测试函数 , 可以像这样

go test -v -run 测试函数名字

例如:

rpc_test.go

package tools

import (
    "go-fly-muti/frpc"
    "testing"
)

func TestClientRpc(t *testing.T) {
    frpc.ClientRpc()
}
func TestServerRpc(t *testing.T) {
    frpc.NewRpcServer("127.0.0.1:8082")
}

执行 TestClientRpc函数

go test -v -run TestClientRpc