Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-async/ #6

Open
utterances-bot opened this issue Feb 25, 2022 · 7 comments
Open

go-async/ #6

utterances-bot opened this issue Feb 25, 2022 · 7 comments

Comments

@utterances-bot
Copy link

Retrofitting Async/Await in Go 1.18 | CS Grinding

It is idiomatic to use channels in Go, so why do we need async/await?

https://csgrinding.xyz/go-async/

Copy link

Are you sure this is correct?

// inside an async function
hello = await GetDataAsIntAsync("hello")
foo = await GetDataAsIntAsync("hello")

This will execute the call synchronously.

How about:
hello = GetDataAsIntAsync("hello")
foo = GetDataAsIntAsync("hello")

hello_res = await hello
foo_res = await foo

@ChayimFriedman2
Copy link

@Dragomir-Ivanov Promise.all():

const [hello, foo] = await Promise.all([GetDataAsIntAsync("hello"), GetDataAsIntAsync("hello")]);

@Dragomir-Ivanov
Copy link

@ChayimFriedman2 Yes, that is little more complex analog to my proposal.
In any case, the code in the article is misleading.

Copy link

luqmansen commented Mar 3, 2022

I believe we have errgroup for more idiomatic error handling

@bobfang1992
Copy link
Owner

Are you sure this is correct?

// inside an async function hello = await GetDataAsIntAsync("hello") foo = await GetDataAsIntAsync("hello")

This will execute the call synchronously.

How about: hello = GetDataAsIntAsync("hello") foo = GetDataAsIntAsync("hello")

hello_res = await hello foo_res = await foo

yes, you are right. I will update this later. Thanks!

Copy link

You should take a drink and forget about that async repo like bad memories from your ex and start using mine :P => https://github.com/jamestrandung/go-concurrency

I reworked the async library from my company to fully support generics and made major enhancements & 10x performance improvement to a feature.

The old version is being used inside my company to serve millions of requests daily at scale. Think about what you can do with mine :).

@bobfang1992
Copy link
Owner

@jamestrandung sure thanks for the info will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants