Skip to content

Commit

Permalink
fix: define const in pack
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelVallenet committed Jul 28, 2022
1 parent 3bc6220 commit d8e2137
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions internal/githubprovider/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import (
"moul.io/multipmuri/pmbodyparser"
)

const InvalidDuration string = "invalid"
const UndefinedDuration string = "undefined"
const (
InvalidDuration string = "invalid"
UndefinedDuration string = "undefined"
)

func fromIssues(issues []*github.Issue, logger *zap.Logger) dvmodel.Batch {
batch := dvmodel.Batch{}
Expand Down Expand Up @@ -150,15 +152,12 @@ func fromIssue(batch *dvmodel.Batch, input *github.Issue) error {
}

func parseDuration(body string) string {
compile, err := regexp.Compile(`time[ \t]+([w|d|h|m|0-9]+)`)
if err != nil {
return UndefinedDuration
}
compile := regexp.MustCompile(`time[ \t]+([w|d|h|m|0-9]+)`)
match := compile.FindStringSubmatch(body)
if len(match) < 2 || len(match[1]) == 0 {
return UndefinedDuration
}
_, err = str2duration.ParseDuration(match[1])
_, err := str2duration.ParseDuration(match[1])
if err != nil {
return InvalidDuration
}
Expand Down

0 comments on commit d8e2137

Please sign in to comment.