diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-04-08 09:31:14 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 09:31:14 +1000 |
commit | 426375b7cdc6727a49a5caab051b82b00babbdc2 (patch) | |
tree | 5a71a868efe921c21302d854cdae2f1845c384f5 /pkg/gui/presentation/graph/graph.go | |
parent | ed61b9a7f2e2ca07643ded8e33a6d38e57f32b22 (diff) | |
parent | f933a2f7ec2e0ab280d41a7d1582729c1acab92b (diff) |
Replace min/max helpers with built-in min/max (#3482)
- **PR Description**
We upgraded our minimum Go version to 1.21 in commit
57ac9c2189458a7f0e63c2e9cac8334694a3d545. 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
- **Please check if the PR fulfills these requirements**
* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [ ] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [ ] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [ ] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc
<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
Diffstat (limited to 'pkg/gui/presentation/graph/graph.go')
-rw-r--r-- | pkg/gui/presentation/graph/graph.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/gui/presentation/graph/graph.go b/pkg/gui/presentation/graph/graph.go index a310d98d9..f6ecf6f0c 100644 --- a/pkg/gui/presentation/graph/graph.go +++ b/pkg/gui/presentation/graph/graph.go @@ -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] } |