Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Go 访问内存位置数组中的数据_Go_Ethereum_Go Ethereum - Fatal编程技术网

Go 访问内存位置数组中的数据

Go 访问内存位置数组中的数据,go,ethereum,go-ethereum,Go,Ethereum,Go Ethereum,我试图在geth中解析下面的类型数组以“查看内部”并获取信息,但不知道如何做。 txs[]*types.Transaction 该类型在geth的其他地方声明为 type Transaction struct { data txdata hash atomic.Value size atomic.Value from atomic.Value } 我试图使用下面的循环访问数据,但我似乎无法访问这些值中的任何一个 for _,

我试图在geth中解析下面的类型数组以“查看内部”并获取信息,但不知道如何做。

txs[]*types.Transaction

该类型在geth的其他地方声明为

type Transaction struct {
    data    txdata
    hash    atomic.Value
    size    atomic.Value
    from    atomic.Value
}
我试图使用下面的循环访问数据,但我似乎无法访问这些值中的任何一个

    for _, tx := range *txs {
        fmt.Println(fmt.Sprintf("transactions in this block - hash: %s and data: ", tx.hash))
    }
是否有人能为我指出正确的方向,告诉我如何访问作为数组的内存位置中的数据

具有访问器方法:

func (tx *Transaction) Hash() common.Hash
func (tx *Transaction) Data() []byte
func (tx *Transaction) Nonce() uint64
func (tx *Transaction) To() *common.Address
(还有更多)


阅读软件包文档并学习Go。小写字段名是未报告的(私有)。

请参阅文档中的示例:只有2个方法。请浏览Go。给定的txs声明与您在其上的范围不匹配。我是新来的,已经开始了围棋之旅,但仍然不知道如何解析它。为什么您试图访问未报告的值?你不应该这样做。它们没有被报道是有原因的。一点帮助都没有。。。。答案如下