You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-26 00:01:35 +02:00
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
|
|
}
|