Skip to content

Commit bd5f180

Browse files
committed
Deprecate
1 parent 8c83d58 commit bd5f180

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
# golib
2+
3+
This library was created mainly to house Ptr() which is no longer required as of
4+
go 1.26, so the entire library and all functions are deprecated.

gl/ptr.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package gl
22

3+
//go:fix inline
34
func Ptr[T any](v T) *T {
4-
return &v
5+
return new(v)
56
}
67

8+
// Deprecated
79
func Coalesce[T any](fallback T, try ...*T) T {
810
for _, v := range try {
911
if v != nil {
@@ -13,20 +15,23 @@ func Coalesce[T any](fallback T, try ...*T) T {
1315
return fallback
1416
}
1517

18+
// Deprecated
1619
func Opt[T any](v *T) (o T) {
1720
if v == nil {
1821
return // the default value, "", 0, false etc
1922
}
2023
return *v
2124
}
2225

26+
// Deprecated
2327
func MustUnwrap[T any](v *T) T {
2428
if v == nil {
2529
panic("nil value")
2630
}
2731
return *v
2832
}
2933

34+
// Deprecated
3035
func Must[T any](v T, err error) T {
3136
if err != nil {
3237
panic(err)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/pentops/golib
22

3-
go 1.23.2
3+
go 1.26

go.sum

Whitespace-only changes.

0 commit comments

Comments
 (0)