Error when trying to use go client with `dep`

I keep seeing this error when trying to build a package that manages dependencies using dep:

➜  artemis git:(dgraph) ✗ go build
# rsi/artemis/vendor/github.com/dgraph-io/dgraph/client
vendor/github.com/dgraph-io/dgraph/client/mutations.go:71:7: undefined: badger.KV

What is the issue here? I only added "github.com/dgraph-io/dgraph/client" to my imports, and ran dep ensure before running go build, and this works for all other packages I’ve installed so far

Hi @felipellrocha,

This is happening because v8.3.0 of dgraph (which is looks like you’re using?) is not compatible with master of badger.

You should use a constraint in your Gopkg.toml file to lock badger to version 0.8 (the version of badger that was used in dgraph v0.8.3).

How do I do that? Like this?

[[constraint]]
  name = "github.com/dgraph-io/dgraph"
  version = "=0.8.3"

[[constraint]]
  name = "github.com/dgraph-io/badger"
  version = "=v0.8.0"

Solved this by adding: required = ["github.com/dgraph-io/badger"] to my Gopkg.toml file

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.