mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
refactor: use the built-in max/min to simplify the code (#17059)
### Summary In Go 1.21, the standard library includes built-in [max/min](https://pkg.go.dev/builtin@go1.21.0#max) function, which can greatly simplify the code. Signed-off-by: futurehua <futurehua@outlook.com>
This commit is contained in:
@@ -711,13 +711,6 @@ func getString(v interface{}) string {
|
||||
return fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func getFloat(v interface{}) float64 {
|
||||
if v == nil {
|
||||
return 0
|
||||
|
||||
@@ -914,10 +914,3 @@ func isTextContent(data []byte) bool {
|
||||
// Check for null bytes (indicates binary)
|
||||
return !slices.Contains(data, 0)
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user