Golang slice ergodic value problem

func MaxMin(position [][]float64) (max, min []float64) {

    for k, v := range position {
        if k == 0 {
            max = position[k]
            min = position[k]
            continue
        }
        if v[0] > max[0] {
            max[0] = v[0]
        }
        if v[1] > max[1] {
            max[1] = v[1]
        }
        if v[0] < min[0] {
            min[0] = v[0]
        }
        if v[1] < min[1] {
            min[1] = v[1]
        }
        fmt.Println(v)
    }
    return
}

the last return value is always the last bit of traversal, which should be affected by the characteristics of slice
optimize

Mar.12,2021

func MaxMin(position [][]float64) (max, min [2]float64) { // 

    for k, v := range position {
        if k == 0 {
            max = [2]float64{
                position[k][0],
                position[k][1],
            }
            min = [2]float64{
                position[k][0],
                position[k][1],
            }
            continue
        }
        if v[0] > max[0] {
            max[0] = v[0]
        }
        if v[1] > max[1] {
            max[1] = v[1]
        }
        if v[0] < min[0] {
            min[0] = v[0]
        }
        if v[1] < min[1] {
            min[1] = v[1]
        }
        fmt.Println(v)
    }
    return
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bea98a-30756.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bea98a-30756.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?