You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ze...@apache.org on 2026/01/22 17:26:19 UTC

(iceberg-go) branch main updated: refactor(iceberg): replace max util with std equivalent (#690)

This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new ad086d26 refactor(iceberg): replace max util with std equivalent (#690)
ad086d26 is described below

commit ad086d2613879a5699e40419330c57514d17a121
Author: ferhat elmas <el...@gmail.com>
AuthorDate: Thu Jan 22 18:26:14 2026 +0100

    refactor(iceberg): replace max util with std equivalent (#690)
    
    Signed-off-by: ferhat elmas <el...@gmail.com>
---
 schema.go |  2 +-
 utils.go  | 16 ----------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/schema.go b/schema.go
index 30bf3076..a13b8a32 100644
--- a/schema.go
+++ b/schema.go
@@ -1103,7 +1103,7 @@ func (findLastFieldID) Schema(_ *Schema, result int) int {
 }
 
 func (findLastFieldID) Struct(_ StructType, fieldResults []int) int {
-	return max(fieldResults...)
+	return slices.Max(fieldResults)
 }
 
 func (findLastFieldID) Field(field NestedField, fieldResult int) int {
diff --git a/utils.go b/utils.go
index 434c8d1d..a1dec28b 100644
--- a/utils.go
+++ b/utils.go
@@ -18,7 +18,6 @@
 package iceberg
 
 import (
-	"cmp"
 	"fmt"
 	"hash/maphash"
 	"maps"
@@ -38,21 +37,6 @@ func init() {
 
 func Version() string { return version }
 
-func max[T cmp.Ordered](vals ...T) T {
-	if len(vals) == 0 {
-		panic("can't call max with no arguments")
-	}
-
-	out := vals[0]
-	for _, v := range vals[1:] {
-		if v > out {
-			out = v
-		}
-	}
-
-	return out
-}
-
 // Optional represents a typed value that could be null
 type Optional[T any] struct {
 	Val   T