Re: [go-nuts] Re: Best coding practice for resiliient client-server communications

2022-05-25 Thread fgergo
In case you're interested in details of github.com/rogpeppe/retry :
https://www.youtube.com/watch?v=yZTEAXdcuH4

On 5/25/22, Tamás Gulácsi  wrote:
> I bet on https://pkg.go.dev/github.com/rogpeppe/retry - it allows a simple
>
> for iter := strategy.Start(); iter.Next(ctx.Done()); {
>   if err := todo(ctx); err == nil {
> break
>   } else if permanent(err) {
> break
>   }
> }
>
> portt...@gmail.com a következőt írta (2022. május 25., szerda, 16:02:16
> UTC+2):
>
>> This was an interesting read:
>>
>> "Timeouts, retries, and backoff with jitter"
>>
>> https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/
>>
>> I wonder what is a good practice in Go code to retry/reconnect/recover but
>>
>> not too aggressively, when connections fail or are stalling or choppy?
>> (Not
>> really AWS specific...)
>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/119cbaba-d3b7-4cc0-b1b5-7d86c71bcf7bn%40googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bctqro%2BWMGKpg2nNR%2BXxCg2CRpct47ghZJM-%3Dx7e8XiqfC9Uw%40mail.gmail.com.


[go-nuts] Re: Best coding practice for resiliient client-server communications

2022-05-25 Thread Tamás Gulácsi
I bet on https://pkg.go.dev/github.com/rogpeppe/retry - it allows a simple 

for iter := strategy.Start(); iter.Next(ctx.Done()); {
  if err := todo(ctx); err == nil {
break
  } else if permanent(err) {
break
  }
}

portt...@gmail.com a következőt írta (2022. május 25., szerda, 16:02:16 
UTC+2):

> This was an interesting read: 
>
> "Timeouts, retries, and backoff with jitter"
>
> https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/
>
> I wonder what is a good practice in Go code to retry/reconnect/recover but 
> not too aggressively, when connections fail or are stalling or choppy? (Not 
> really AWS specific...) 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/119cbaba-d3b7-4cc0-b1b5-7d86c71bcf7bn%40googlegroups.com.


[go-nuts] Best coding practice for resiliient client-server communications

2022-05-25 Thread Anssi Porttikivi
This was an interesting read: 

"Timeouts, retries, and backoff with jitter"
https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/

I wonder what is a good practice in Go code to retry/reconnect/recover but 
not too aggressively, when connections fail or are stalling or choppy? (Not 
really AWS specific...) 


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a6c238ca-706e-4df8-be8f-5703f00bee09n%40googlegroups.com.


[go-nuts] Re: “Normal” vs. “error” (control flow) is a fundamental semantic distinction

2022-05-25 Thread Zhaoxun Yan
Try & Catch sounds great!

在2022年5月19日星期四 UTC+8 00:15:09 写道:

> Hi all,
>
> I thought now was the time to go public. The automatic error propagation 
> is possible with the help of a simple Go package, and it has been about 
> three years now:
>
> func CopyFile(src, dst string) (err error) {
> defer err2.Returnf(&err, "copy %s %s", src, dst)
>
> r := try.To1(os.Open(src))
> defer r.Close()
>
> w := try.To1(os.Create(dst))
> defer err2.Handle(&err, func() {
> _ = os.Remove(dst)
> })
> defer w.Close()
>
> try.To1(io.Copy(w, r))
> return nil
> }
>
> The playground .
>
> A couple of blog posts about the subject:
>
>- Error Propagation 
>
> 
>- Errors as Discriminated Unions 
>
>
> I'm the author of those posts and the err2 package 
> . Additional sources for original ideas 
> are mentioned in the blogs and the package documentation. And, of course, 
> pure error values are needed when transporting errors through channels.
>
> I hope that any gopher who tries the err2 package finds it as valuable and 
> productive
> as we have. Indeed, Go is one of the most pragmatic and refactor-friendly 
> native languages.
>
> Best regards,
> -Harri
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/27a9b63c-ad67-475d-851a-97fadb94b3dfn%40googlegroups.com.


Re: [go-nuts] Re: Installing a package with an associated command

2022-05-25 Thread 'Sean Liao' via golang-nuts
`go install github.com/your/repo/cmd/...@latest` should work

replace `latest` with specific versions (eg prereleases) if necessary

- sean

On Wed, May 25, 2022, 08:50 christoph...@gmail.com <
christophe.mees...@gmail.com> wrote:

> Indeed, it works. What if there are multiple binaries to install ? Does
> the user have to type the full package name for each program he want to
> install ?
>
> Isn’t there an equivalent to "go install ./..." that installs everything
> in one simple and short instruction ?
>
> Le mercredi 25 mai 2022 à 08:40:04 UTC+2, Volker Dobler a écrit :
>
>> If you want the command to be installed: Why don't you install
>> _the_ _command_ with
>> go install https://github.com/chmike/clog/cmd/clogClr@latest
>> ? (Note that there is no need to install the package.)
>>
>> V.
>>
>> On Wednesday, 25 May 2022 at 08:13:58 UTC+2 christoph...@gmail.com wrote:
>>
>>> I have a small package (https://github.com/chmike/clog) that also
>>> contains a command in the cmd subdirectory (clogClr). How do I install
>>> the clog package and the command ?
>>>
>>> When I execute "go install github.com/chmike/clog@latest" I get the
>>> error message that it is not a main package. When I use go get that package
>>> is installed, but not the command (clogClr).
>>>
>>> I understand that for security purpose installing a package should not
>>> automatically install an executable binary.
>>>
>>> For now I do a git clone and a "go install ./...". It's fine for me, not
>>> for an end user. I assume there is a better way.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/58eb2ba5-b44c-45b5-909e-b6cf85c65bd8n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPrAPLTmAo6_31_N%3DNTNM%2BCXsfu-DhfAFCpB40DTktwYpA%40mail.gmail.com.


[go-nuts] Re: Installing a package with an associated command

2022-05-25 Thread Peter Galbavy
It's worth noting that @latest only works for "releases" and not for 
tags/releases labelled pre-release. Just in case anyone hits the same issue 
I did a while back! :)

On Wednesday, 25 May 2022 at 07:40:04 UTC+1 Volker Dobler wrote:

> If you want the command to be installed: Why don't you install
> _the_ _command_ with 
> go install https://github.com/chmike/clog/cmd/clogClr@latest
> ? (Note that there is no need to install the package.)
>
> V.
>
> On Wednesday, 25 May 2022 at 08:13:58 UTC+2 christoph...@gmail.com wrote:
>
>> I have a small package (https://github.com/chmike/clog) that also 
>> contains a command in the cmd subdirectory (clogClr). How do I install 
>> the clog package and the command ? 
>>
>> When I execute "go install github.com/chmike/clog@latest" I get the 
>> error message that it is not a main package. When I use go get that package 
>> is installed, but not the command (clogClr). 
>>
>> I understand that for security purpose installing a package should not 
>> automatically install an executable binary. 
>>
>> For now I do a git clone and a "go install ./...". It's fine for me, not 
>> for an end user. I assume there is a better way. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/248b767d-d4d2-473a-a685-35c41eab6bfan%40googlegroups.com.


[go-nuts] Re: Installing a package with an associated command

2022-05-25 Thread christoph...@gmail.com
Indeed, it works. What if there are multiple binaries to install ? Does the 
user have to type the full package name for each program he want to install 
?

Isn’t there an equivalent to "go install ./..." that installs everything in 
one simple and short instruction ? 

Le mercredi 25 mai 2022 à 08:40:04 UTC+2, Volker Dobler a écrit :

> If you want the command to be installed: Why don't you install
> _the_ _command_ with 
> go install https://github.com/chmike/clog/cmd/clogClr@latest
> ? (Note that there is no need to install the package.)
>
> V.
>
> On Wednesday, 25 May 2022 at 08:13:58 UTC+2 christoph...@gmail.com wrote:
>
>> I have a small package (https://github.com/chmike/clog) that also 
>> contains a command in the cmd subdirectory (clogClr). How do I install 
>> the clog package and the command ? 
>>
>> When I execute "go install github.com/chmike/clog@latest" I get the 
>> error message that it is not a main package. When I use go get that package 
>> is installed, but not the command (clogClr). 
>>
>> I understand that for security purpose installing a package should not 
>> automatically install an executable binary. 
>>
>> For now I do a git clone and a "go install ./...". It's fine for me, not 
>> for an end user. I assume there is a better way. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/58eb2ba5-b44c-45b5-909e-b6cf85c65bd8n%40googlegroups.com.