0

The error message :

cannot use (func(c *object.Commit) error literal) (value of type func(c *"github.com/go-git/go-git/plumbing/object".Commit) error) as func(*"github.com/go-git/go-git/v5/plumbing/object".Commit) error value in argument to iterator.ForEach

The code which has error:

    err = iterator.ForEach(func(c *object.Commit) error {
        daysAgo := countDaysSinceDate(c.Author.When) + offset

        if c.Author.Email != email {
            return nil
        }

        if daysAgo != outOfRange {
            commits[daysAgo]++
        }

        return nil
    })

I was using the go-get package in the project but idk why this error is coming

  • 2
    The Object type's import paths don't match. One has `/v5/` in it, the other doesn't. They must match for them to be considered of the same type. This means that `object.Commit` version imported by the `iterator.ForEach` func, and the `object.Commit` version imported by your code, do not match. Your code needs to import the same version as the one imported by the `iterator` package. – mkopriva Oct 30 '22 at 13:01

0 Answers0