change: RoundToOneDecimal

This commit is contained in:
lilong.129
2025-06-05 17:47:29 +08:00
parent c4e7ab00a7
commit 8cdc71d90b
6 changed files with 27 additions and 18 deletions

View File

@@ -374,6 +374,11 @@ func ConvertToStringSlice(val interface{}) ([]string, error) {
return stringSlice, nil
}
// RoundToOneDecimal rounds a float64 value to 1 decimal place
func RoundToOneDecimal(val float64) float64 {
return math.Round(val*10) / 10.0
}
func GetFreePort() (int, error) {
minPort := 20000
maxPort := 50000