简体   繁体   English

编译期间调用的 arguments 过多

[英]Too many arguments in call during compilation

I would like to use a package in my Go project, but I can't even compile the code successfully because of the following error:我想在我的 Go 项目中使用 package,但由于以下错误,我什至无法成功编译代码:

C:\Users\usr01\go\pkg\mod\github.com\alethio\web3-multicall-go@v0.0.15\multicall\viewcall.go:259:8: assignment mismatch: 1 variable but wrapperArgs.Unpack returns 2 values 

C:\Users\usr01\go\pkg\mod\github.com\alethio\web3-multicall-go@v0.0.15\multicall\viewcall.go:259:37: too many arguments in call to wrapperArgs.Unpack

This happens when I start my program with go run , I assume during the compilation because the code which uses the package doesn't get called.当我使用go run启动我的程序时会发生这种情况,我假设在编译期间因为使用 package 的代码没有被调用。 I am new to this language, but what I could investigate is the problem occurs before the 259. line of the viewcall.go file which belongs to the web3-go-multicall package .我是这种语言的新手,但我可以调查的是问题发生在viewcall.go 文件的 259. 行之前,该文件属于web3-go-multicall package

This is where the problem occurs:这是出现问题的地方:

data, err := wrapperArgs.Unpack(rawBytes)

What I don't understand, why this issue happens anyway?我不明白,为什么会出现这个问题? Because both returned variables are assigned to data and err so the assignment mismatch: 1 variable but wrapperArgs.Unpack returns 2 values error seems incorrect for me.因为两个返回的变量都分配给dataerr所以assignment mismatch: 1 variable but wrapperArgs.Unpack returns 2 values错误对我来说似乎不正确。

wrapperArgs := abi.Arguments{
    {
        Name: "BlockNumber",
        Type: uint256Type,
    },
    {
        Name: "Returns",
        Type: returnType,
    },
}
data, err := wrapperArgs.Unpack(rawBytes)

You have linked the code in master, but according to logs that you have provided you are on version v0.0.15 .您已将代码链接到 master 中,但根据您提供的日志,您的版本v0.0.15 And in that version there is only 1 argument on the left side and 2 arguments passed to a function - https://github.com/Alethio/web3-multicall-go/blob/v0.0.15/multicall/viewcall.go#L259 And in that version there is only 1 argument on the left side and 2 arguments passed to a function - https://github.com/Alethio/web3-multicall-go/blob/v0.0.15/multicall/viewcall.go#L259

Probably 2 libraries ( github.com/Alethio/web3-multicall-go and github.com/ethereum/go-ethereum or some child of that) have incompatible versions.可能有 2 个库( github.com/Alethio/web3-multicall-gogithub.com/ethereum/go-ethereum或其中的一些子库)具有不兼容的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM