It's a seemingly simple operation but I can't find an obvious way to do this using the go-ethereum
library.
Given a blockchain client like so:
client, err := ethclient.Dial("http://localhost:8545")
The only available methods are:
BalanceAt
BlockByHash
BlockByNumber
CallContract
Close
CodeAt
EstimateGas
FilterLogs
HeaderByHash
HeaderByNumber
NetworkID
NonceAt
PendingBalanceAt
PendingCallContract
PendingCodeAt
PendingNonceAt
PendingStorageAt
PendingTransactionCount
SendTransaction
StorageAt
SubscribeFilterLogs
SubscribeNewHead
SuggestGasPrice
SyncProgress
TransactionByHash
TransactionCount
TransactionInBlock
TransactionReceipt
TransactionSender
Which does not include GetBlockNumber
like it does in web3.js for example.
eth.getBlock('latest')
or,eth_getBlockByNumber('latest')