From 2f5e2f6cc12b4f654b96d6ac6da80cd693e33fc4 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 26 May 2023 11:12:12 +0700 Subject: [PATCH] builtin: add documentation for min/max Updates #59488 Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d Reviewed-on: https://go-review.googlesource.com/c/go/+/498495 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Auto-Submit: Cuong Manh Le Reviewed-by: Matthew Dempsky Run-TryBot: Cuong Manh Le --- src/builtin/builtin.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index bcfb7ce956..03e90c8a56 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -10,6 +10,8 @@ for the language's special identifiers. */ package builtin +import "cmp" + // bool is the set of boolean values, true and false. type bool bool @@ -206,6 +208,14 @@ func cap(v Type) int // unbuffered. func make(t Type, size ...IntegerType) Type +// The max built-in function returns the largest value of a fixed number of +// arguments of [cmp.Ordered] types. There must be at least one argument. +func max[T cmp.Ordered](x T, y ...T) T + +// The min built-in function returns the smallest value of a fixed number of +// arguments of [cmp.Ordered] types. There must be at least one argument. +func min[T cmp.Ordered](x T, y ...T) T + // The new built-in function allocates memory. The first argument is a type, // not a value, and the value returned is a pointer to a newly // allocated zero value of that type. -- 2.51.0