Skip to content

having issue in item.Value() in blockchain/blockchain.go #5

Open
@laibleeds

Description

@laibleeds

image
i can not resolve the error here, which says " cannot assign 1 values to 2 variables" & "too few arguments in call to item.Value"

please help me out with it, currently i'm using go version 1.15.8 on VScode

Activity

rishikeshkchapekar

rishikeshkchapekar commented on Feb 16, 2021

@rishikeshkchapekar

I had the same problem. It seems BadgerDB Go package has updated since the video series was published, and the item.Value() syntax has changed

So I looked up the Badger docs, and fixed the code according to the latest version. So now the code looks this:

var encodedBlock []byte
err = item.Value(func(val []byte) error{
	encodedBlock = val
	return nil
})

You can see the latest docs here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      having issue in item.Value() in blockchain/blockchain.go · Issue #5 · tensor-programming/golang-blockchain