aboutsummaryrefslogtreecommitdiff
path: root/src/builtin
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2023-05-26 11:12:12 +0700
committerGopher Robot <gobot@golang.org>2023-06-04 15:12:46 +0000
commit2f5e2f6cc12b4f654b96d6ac6da80cd693e33fc4 (patch)
treeaa969929d6d80827b885962859d8b5508c748b9b /src/builtin
parentce8146ed3361f584ba79427ac6c6d6fe9c297bea (diff)
downloadgo-2f5e2f6cc12b4f654b96d6ac6da80cd693e33fc4.tar.gz
go-2f5e2f6cc12b4f654b96d6ac6da80cd693e33fc4.zip
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 <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/builtin')
-rw-r--r--src/builtin/builtin.go10
1 files changed, 10 insertions, 0 deletions
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.