mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 13:45:19 +00:00
Revert "cherry pick only IfZero
from (#29755)"
This reverts commit 82851f429a
.
This commit is contained in:
parent
1684f0e5bf
commit
a38260aed9
|
@ -212,12 +212,3 @@ func ToFloat64(number any) (float64, error) {
|
||||||
func ToPointer[T any](val T) *T {
|
func ToPointer[T any](val T) *T {
|
||||||
return &val
|
return &val
|
||||||
}
|
}
|
||||||
|
|
||||||
// IfZero returns "def" if "v" is a zero value, otherwise "v"
|
|
||||||
func IfZero[T comparable](v, def T) T {
|
|
||||||
var zero T
|
|
||||||
if v == zero {
|
|
||||||
return def
|
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue