[英]How to run go core library tests with an `internal` import?
I am trying to run the tests in crypto/tls
.我正在尝试在crypto/tls
中运行测试。 The problem is that every time I try to run tests I get :问题是每次我尝试运行测试时都会得到:
common.go:20:2: use of internal package internal/cpu not allowed
This makes sense as tls
is a package and does not have a local internal
directory like a normal package.这是有道理的,因为tls
是 package 并且没有像普通 package 那样的本地internal
目录。
So my question is how are these test run to get around this restriction?所以我的问题是这些测试如何运行来绕过这个限制?
Ok so here is the Quick and dirty method to run custom tests in the standard/core library:好的,这是在标准/核心库中运行自定义测试的快速而肮脏的方法:
GOOS=linux GOARCH=amd64 ./all.bash
$GOROOT=$PWD GOBIN=$PWD/bin GOMODCACHE=$PWD/pkg/mod GOPATH=/tmp/gotest ./bin/go test crypto/tls
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.