Skip to content

Commit 1043f8c

Browse files
committed
refactor(utils): rename GetGitMaxTag to GetNextGitMaxTag
1 parent 36d6071 commit 1043f8c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

cmds/fastcommit/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func New(params Params) *Command {
8181
})
8282
s.Start()
8383
resp, err := params.OpenaiClient.Client.CreateChatCompletion(
84-
context.Background(),
84+
ctx,
8585
openai.ChatCompletionRequest{
8686
Model: params.OpenaiClient.Cfg.Model,
8787
Messages: []openai.ChatCompletionMessage{

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/charmbracelet/x/term v0.2.1
1313
github.com/hashicorp/go-version v1.7.0
1414
github.com/pubgo/dix v0.3.21-alpha.1
15-
github.com/pubgo/funk v0.5.64-alpha.1
15+
github.com/pubgo/funk v0.5.65-alpha.2
1616
github.com/rs/zerolog v1.33.0
1717
github.com/samber/lo v1.47.0
1818
github.com/sashabaranov/go-openai v1.38.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
8686
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8787
github.com/pubgo/dix v0.3.21-alpha.1 h1:e7j8+E9eBAaYYMnPaMzobivUdbZIAnRnGojn6bs9TyY=
8888
github.com/pubgo/dix v0.3.21-alpha.1/go.mod h1:oXaieLnEtHKTtyRgGE2LDdRdwaEsf7OrrxStIEcFbEo=
89-
github.com/pubgo/funk v0.5.64-alpha.1 h1:RPS5k4c7qcjN3VT42p7O9sJIL7Nv0gu4ZwQi5M4fIIY=
90-
github.com/pubgo/funk v0.5.64-alpha.1/go.mod h1:VMNDJsIFOSMUZ2PRfyIyUQkDpfnFnOYZelFa1r/dmgs=
89+
github.com/pubgo/funk v0.5.65-alpha.2 h1:XvRRmIMtY2lMwTaK1j4LHKbmsgqyKBSdc2KgUqtbz6s=
90+
github.com/pubgo/funk v0.5.65-alpha.2/go.mod h1:tfDZqz/x00YvqbvluiMh2s5HmZh1OIjNcv4fsdh4kSQ=
9191
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
9292
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
9393
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=

utils/util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ func GetNextReleaseTag(tags []*semver.Version) *semver.Version {
5454
}
5555

5656
func GetNextTag(pre string, tags []*semver.Version) *semver.Version {
57-
var maxVer = GetGitMaxTag(tags)
57+
var maxVer = GetNextGitMaxTag(tags)
5858
var curMaxVer = typex.DoBlock1(func() *semver.Version {
5959
tags = lo.Filter(tags, func(item *semver.Version, index int) bool { return strings.Contains(item.String(), pre) })
6060
return lo.MaxBy(tags, func(a *semver.Version, b *semver.Version) bool { return a.Compare(b) > 0 })
6161
})
6262

6363
var ver string
64-
if curMaxVer != nil && curMaxVer.GreaterThan(maxVer) {
64+
if curMaxVer != nil && curMaxVer.Core().GreaterThanOrEqual(maxVer) {
6565
ver = strings.ReplaceAll(curMaxVer.Prerelease(), fmt.Sprintf("%s.", pre), "")
6666
ver = fmt.Sprintf("v%s-%s.%d", curMaxVer.Core().String(), pre, assert.Must1(strconv.Atoi(ver))+1)
6767
} else {
@@ -70,7 +70,7 @@ func GetNextTag(pre string, tags []*semver.Version) *semver.Version {
7070
return assert.Must1(semver.NewSemver(ver))
7171
}
7272

73-
func GetGitMaxTag(tags []*semver.Version) *semver.Version {
73+
func GetNextGitMaxTag(tags []*semver.Version) *semver.Version {
7474
maxVer := semver.Must(semver.NewVersion("v0.0.1"))
7575
if len(tags) == 0 {
7676
return maxVer

0 commit comments

Comments
 (0)