On Friday, November 22, 2024 at 5:27:10 PM UTC+8 Lin Lin wrote:
Hi, gophers, here is our dilemma.
We build system managing infrastructure such as Kubernetes. With that comes
the need to write
a lot of maintenance scripts. For now they are all written in Bash, which
is hard to edit and test.
As a firm advocate for Go, I do not think Go is a good choice for what
you're trying to do. Maybe if you wanted to just use a JIT compiler for
your scripts? Since Go compiles so fast, you may not even notice the
compile time for small, 500-line "scripts". Otherwise, if it has to be
interprete
Is there a library or reference-implementation for oauth token set-up,
storage & refresh in golang. For example, my implementation is similar to
the send-gmail tool by google (transforms sendmail CLI to gmail smtp
requests, authenticated with oauth)
https://github.com/google/gmail-oauth2-too
On Fri, Nov 22, 2024 at 1:53 AM 'Hartmut Wieselburger' via golang-nuts
wrote:
>
> var configOnce sync.Once
> func Reset() {
> configOnce = sync.Once{}
> }
This is not resetting. You are creating a new sync.Once and assigning
that to a variable. That variable, configOnce, is shared among
multiple
var fOnce func() T
func Reset() {
fOnce = sync.OnceValue(your code here)
}
But as I said: Both is _wrong_. Really totally wrong.
The OnceValue code should make this clear.
Stop doing this. Redesign.
V.
On Friday, 22 November 2024 at 11:41:28 UTC+1 Hartmut Wieselburger wrote:
> | You can do the sa
| You can do the same with OnceValue
Can you give an example?
Volker Dobler schrieb am Freitag, 22. November 2024 um 11:32:41 UTC+1:
> You can do the same with OnceValue, but neither is a good idea
> as it totally invalidates what sync.Once is good for: preventing
> data races which your "reset
You can do the same with OnceValue, but neither is a good idea
as it totally invalidates what sync.Once is good for: preventing
data races which your "reset" (in quotation marks as you do not
reset the sync.Once) provokes.
V.
On Friday, 22 November 2024 at 09:52:59 UTC+1 Hartmut Wieselburger wrot
Hi, gophers, here is our dilemma.
We build system managing infrastructure such as Kubernetes. With that comes
the need to write
a lot of maintenance scripts. For now they are all written in Bash, which
is hard to edit and test.
As the community suggests, do not write Bash code more than 100 lin
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:
> >
> > Hi,
> > is the