1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Replace min/max helpers with built-in min/max

We upgraded our minimum Go version to 1.21 in commit
57ac9c2189. We can now replace our
`utils.Min` and `utils.Max` functions with the built-in `min` and `max`.

Reference: https://go.dev/ref/spec#Min_and_max
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2024-04-07 23:24:10 +08:00
parent ed61b9a7f2
commit f933a2f7ec
12 changed files with 20 additions and 73 deletions

View File

@ -42,11 +42,11 @@ func ContainsCommitSha(pipes []*Pipe, sha string) bool {
}
func (self Pipe) left() int {
return utils.Min(self.fromPos, self.toPos)
return min(self.fromPos, self.toPos)
}
func (self Pipe) right() int {
return utils.Max(self.fromPos, self.toPos)
return max(self.fromPos, self.toPos)
}
func RenderCommitGraph(commits []*models.Commit, selectedCommitSha string, getStyle func(c *models.Commit) style.TextStyle) []string {
@ -390,7 +390,7 @@ func equalHashes(a, b string) bool {
return false
}
length := utils.Min(len(a), len(b))
length := min(len(a), len(b))
// parent hashes are only stored up to 20 characters for some reason so we'll truncate to that for comparison
return a[:length] == b[:length]
}