diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-09-03 18:34:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-03 10:34:57 +0000 |
commit | fc039167d200b423c95807758628e4899e3ca7df (patch) | |
tree | ce59b8dbeb74d21b5f337b80160abe74c00a94a9 /modules | |
parent | 7477c93d621f4e7f1e09336e6c8bd741b3781f8c (diff) | |
download | gitea-fc039167d200b423c95807758628e4899e3ca7df.tar.gz gitea-fc039167d200b423c95807758628e4899e3ca7df.zip |
Use Go 1.21 and update dependencies (#26878)
To make sure Gitea's next release's lifecycle could have active Golang
support.
And min/max are builtin now.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/indexer/code/search.go | 5 | ||||
-rw-r--r-- | modules/util/util.go | 16 |
2 files changed, 2 insertions, 19 deletions
diff --git a/modules/indexer/code/search.go b/modules/indexer/code/search.go index 1f9bddff7b..fdb468df1a 100644 --- a/modules/indexer/code/search.go +++ b/modules/indexer/code/search.go @@ -11,7 +11,6 @@ import ( "code.gitea.io/gitea/modules/highlight" "code.gitea.io/gitea/modules/indexer/code/internal" "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" ) // Result a search result to display @@ -77,8 +76,8 @@ func searchResult(result *internal.SearchResult, startIndex, endIndex int) (*Res if index < result.EndIndex && result.StartIndex < index+len(line) && result.StartIndex < result.EndIndex { - openActiveIndex := util.Max(result.StartIndex-index, 0) - closeActiveIndex := util.Min(result.EndIndex-index, len(line)) + openActiveIndex := max(result.StartIndex-index, 0) + closeActiveIndex := min(result.EndIndex-index, len(line)) err = writeStrings(&formattedLinesBuffer, line[:openActiveIndex], line[openActiveIndex:closeActiveIndex], diff --git a/modules/util/util.go b/modules/util/util.go index cc25539967..c47931f6c9 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -60,22 +60,6 @@ func OptionalBoolParse(s string) OptionalBool { return OptionalBoolOf(b) } -// Max max of two ints -func Max(a, b int) int { - if a < b { - return b - } - return a -} - -// Min min of two ints -func Min(a, b int) int { - if a > b { - return b - } - return a -} - // IsEmptyString checks if the provided string is empty func IsEmptyString(s string) bool { return len(strings.TrimSpace(s)) == 0 |