Commit acbcfb5e authored by Hector Sanjuan's avatar Hector Sanjuan

Make Golint happy in the blocks submodule.

This has required changing the order of some parameters and
adding HashOnRead to the Blockstore interface (which I have in turn
added to all the wrapper implementations).

License: MIT
Signed-off-by: default avatarHector Sanjuan <hector@protocol.ai>
parent c293b54a
// Package blocksutil provides utility functions for working
// with Blocks.
package blocksutil
import "github.com/ipfs/go-ipfs/blocks"
// NewBlockGenerator returns an object capable of
// producing blocks.
func NewBlockGenerator() BlockGenerator {
return BlockGenerator{}
}
// BlockGenerator generates BasicBlocks on demand.
// For each instace of BlockGenerator,
// each new block is different from the previous,
// although two different instances will produce the same.
type BlockGenerator struct {
seq int
}
// Next generates a new BasicBlock.
func (bg *BlockGenerator) Next() *blocks.BasicBlock {
bg.seq++
return blocks.NewBlock([]byte(string(bg.seq)))
}
// Blocks generates as many BasicBlocks as specified by n.
func (bg *BlockGenerator) Blocks(n int) []*blocks.BasicBlock {
blocks := make([]*blocks.BasicBlock, 0)
for i := 0; i < n; i++ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment