代码拉取完成,页面将自动刷新
// +build testrunmain
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"testing"
)
// this abuses go so much that I felt dirty writing this code
// but it is the only way to do it without writing custom compiler that would
// be a clone of go-build with go-test
func TestRunMain(t *testing.T) {
args := flag.Args()
os.Args = append([]string{os.Args[0]}, args...)
ret := mainRet()
p := os.Getenv("IPFS_COVER_RET_FILE")
if len(p) != 0 {
ioutil.WriteFile(p, []byte(fmt.Sprintf("%d\n", ret)), 0777)
}
// close outputs so go testing doesn't print anything
null, _ := os.Open(os.DevNull)
os.Stderr = null
os.Stdout = null
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。