Use proper error to stop iteration
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
2f1de6fc41
commit
77aa221efe
1 changed files with 2 additions and 2 deletions
4
main.go
4
main.go
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -11,6 +10,7 @@ import (
|
||||||
git "github.com/go-git/go-git/v5"
|
git "github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
"github.com/go-git/go-git/v5/plumbing/object"
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/storer"
|
||||||
gha "github.com/sethvargo/go-githubactions"
|
gha "github.com/sethvargo/go-githubactions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ func main() {
|
||||||
_ = commits.ForEach(func(c *object.Commit) error {
|
_ = commits.ForEach(func(c *object.Commit) error {
|
||||||
// Stop iterator when limit is reached.
|
// Stop iterator when limit is reached.
|
||||||
if lca != nil && c.Hash == lca.Hash {
|
if lca != nil && c.Hash == lca.Hash {
|
||||||
return errors.New("stop")
|
return storer.ErrStop
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse commit data.
|
// Parse commit data.
|
||||||
|
|
Loading…
Reference in a new issue