Go: cannot use hook.Entries (type []logrus.Entry) as type []*logrus.Entry in return argument

Created on 1 Aug 2018  路  8Comments  路  Source: stellar/go

after import package "github.com/stellar/go/clients/horizon"

compiler says

go/src/github.com/stellar/go/support/log/entry.go:125:14: cannot use hook.Entries (type []logrus.Entry) as type []*logrus.Entry in return argument

Most helpful comment

This issue also appears in Go 1.11 when using the new Go Modules feature and importing the horizon client: github.com/stellar/go/clients/horizon

After running go mod init and go build:

# github.com/stellar/go/support/log
go/pkg/mod/github.com/stellar/[email protected]/support/log/entry.go:148:14:
cannot use hook.Entries (type []logrus.Entry) as type []*logrus.Entry in return argument

To fix run the following from your module:

go get -u github.com/sirupsen/logrus@68cec9f21fbf3ea8d8f98c044bc6ce05f17b267a

After this your go.mod file will have the following require entry (along with any other dependencies):

require(
        // ...
    github.com/sirupsen/logrus v0.11.6-0.20170606205945-68cec9f21fbf // indirect
        // ...
)

All 8 comments

Very likely that you did not use glide to install dependencies: https://github.com/stellar/go#dependencies

Sorry I read services/horizon instead of clients/horizon.

@bartekn I hotfix it in my local repo with change []*logrus.Entry to []logrus.Entry in 2 files
image
image

But it's temporary solution

What dependency management tool are you using in your workflow?

I'm getting the same error here, using dep to manage dependencies. Any idea what is it about?

[Edit]
I tried to remove the vendors folder along with Gopkg.lock and Gopkg.toml and run dep ensure again, but the problem persists.

For now I had to hotfix the same way as @frankegoesdown.

glide seems to ignore transitive dependencies. This is one of many reasons we switched to dep recently. You have two options:

  1. Switch to dep too, and update Git revision of github.com/stellar/go to 435de795b0e1ae4ea4638344c5637bff14e31c99 or later - this is where we started using dep (recommended).
  2. If you really want to stick to glide add github.com/sirupsen/logrus at 68cec9f21fbf3ea8d8f98c044bc6ce05f17b267a to your glide.yaml and/or glide.lock files.

This issue also appears in Go 1.11 when using the new Go Modules feature and importing the horizon client: github.com/stellar/go/clients/horizon

After running go mod init and go build:

# github.com/stellar/go/support/log
go/pkg/mod/github.com/stellar/[email protected]/support/log/entry.go:148:14:
cannot use hook.Entries (type []logrus.Entry) as type []*logrus.Entry in return argument

To fix run the following from your module:

go get -u github.com/sirupsen/logrus@68cec9f21fbf3ea8d8f98c044bc6ce05f17b267a

After this your go.mod file will have the following require entry (along with any other dependencies):

require(
        // ...
    github.com/sirupsen/logrus v0.11.6-0.20170606205945-68cec9f21fbf // indirect
        // ...
)
Was this page helpful?
0 / 5 - 0 ratings