Re: [go-nuts] reset sync.OnceValue

2024-11-25 Thread 'Hartmut Wieselburger' via golang-nuts
Ok, thanks, once means once. So https://pkg.go.dev/sync/atomic#Value seems to be a better fit, do you agree? burak serdar schrieb am Freitag, 22. November 2024 um 16:10:00 UTC+1: > On Fri, Nov 22, 2024 at 1:53 AM 'Hartmut Wieselburger' via golang-nuts > wrote: > > > &

Re: [go-nuts] reset sync.OnceValue

2024-11-22 Thread 'Hartmut Wieselburger' via golang-nuts
>> } >> >> func Load() *Config { >> configOnce.Do(func() { >> ... >> } >> >> burak serdar schrieb am Donnerstag, 21. November 2024 um 21:24:40 UTC+1: >> >>> On Thu, Nov 21, 2024 at 1:14 PM 'Hartmut Wieselburger' via golang-nuts >>&g

Re: [go-nuts] reset sync.OnceValue

2024-11-22 Thread 'Hartmut Wieselburger' via golang-nuts
var configOnce sync.Once func Reset() { configOnce = sync.Once{} } func Load() *Config { configOnce.Do(func() { ... } burak serdar schrieb am Donnerstag, 21. November 2024 um 21:24:40 UTC+1: > On Thu, Nov 21, 2024 at 1:14 PM 'Hartmut Wieselburger' via golang-nuts > wrote: &g

[go-nuts] reset sync.OnceValue

2024-11-21 Thread 'Hartmut Wieselburger' via golang-nuts
Hi, is there a way to reset sync.OnceValue(s), as you can do it with sync.Once? A common use case is loading a config. I would like to switch from sync.Once to sync.OnceValue, but I need to a chance to reload my config, without restarting my service. If this is possible with sync.OnceValue, plea