You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-06-11 21:53:28 +02:00
0eec65e230
Signed-off-by: Jan Larwig <jan@larwig.com>
15 lines
250 B
Go
15 lines
250 B
Go
package ptr
|
|
|
|
// To generically returns a pointer to the given value.
|
|
func To[T any](v T) *T {
|
|
return &v
|
|
}
|
|
|
|
// Deref returns the value of the pointer or def(ault) if nil.
|
|
func Deref[T any](p *T, def T) T {
|
|
if p == nil {
|
|
return def
|
|
}
|
|
return *p
|
|
}
|