A go parser for Conventional Commits messages
varmsg=`feat(scope): descriptionthis is first line in bodythis is second line in bodyRef #123Date: 01-01-2021By: John Doe`commit, err:=Parse(msg)
iferr!=nil {
fmt.Printf("Error: %s", err.Error())
}
fmt.Printf("%#v", commit)
/*commitMsg = &parser.Commit{ message: "feat(scope): description\n\nthis is first line in body\n\nthis is second line in body\n\nRef #123\nDate: 01-01-2021\nBy: John Doe", header: "feat(scope): description", body: "this is first line in body\n\nthis is second line in body", footer: "Ref #123\nDate: 01-01-2021\nBy: John Doe", commitType: "feat", scope: "scope", description: "description", notes: { {token:"Ref", value:"123"}, {token:"Date", value:"01-01-2021"}, {token:"By", value:"John Doe"}, }, isBreakingChange: false,}*/- More Test Cases
- Benchmark
This parser is inspired and forked from