xuperchain/xdev

make报错,testing.MainStart提示参数不匹配

Opened this issue · 5 comments

go build -o bin/xdev github.com/xuperchain/xdev

github.com/xuperchain/xdev/jstest

jstest/runner.go:165:55: not enough arguments in call to testing.MainStart
have (testDeps, []testing.InternalTest, nil, nil)
want (testing.testDeps, []testing.InternalTest, []testing.InternalBenchmark, []testing.InternalFuzzTarget, []testing.InternalExample)

github.com/xuperchain/xvm/exec

../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/codec.go:9:18: undefined: NewTrap
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/codec.go:26:19: undefined: Context
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/codec.go:29:3: undefined: Throw
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/codec.go:40:3: undefined: Throw
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/codec.go:83:3: undefined: Throw
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:40:13: undefined: applyFuncCall
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:74:31: undefined: Resolver
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:150:46: undefined: Resolver
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:174:41: undefined: ContextConfig
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:174:62: undefined: Context
../../../../go/pkg/mod/github.com/xuperchain/xvm@v0.0.0-20210126142521-68fd016c56d7/exec/interp.go:40:13: too many errors
make: *** [build] Error 2

辛苦补充 Go 版本等环境信息
合并跟进 #38

辛苦补充 Go 版本等环境信息

go1.18.4

出现这个问题的原因是:
github.com/xuperchain/xdev v1.0.1 基于 go1.15开发。当时 testing 的接口为

func MainStart(deps testDeps, tests []InternalTest, benchmarks []InternalBenchmark, examples []InternalExample) *M 

后续的 go 版本对此接口进行了修改,导致不兼容报错。

解决方案为:
方案1: 环境 go 版本使用 1.15
方案2: 等待代码库升级 go 版本

go 1.18以上注掉这段测试就行
jstest/runner.go
/*
tmain := testing.MainStart(testDeps{}, r.tests, nil, nil, nil)
err = r.initGoTestPackage()
if err != nil {
return err
}
ret := tmain.Run()
if ret != 0 {
return errors.New("")
}
*/