
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
d.zyszy.best/ghosind/go-async
English | 简体中文
It's a powerful asynchronous utility library inspired by JavaScript Promise
Object and Node.js async package.
Run the following command to install this library, and Go 1.18 and later versions required.
go get -u github.com/ghosind/go-async
And then, import the library into your own code.
import "github.com/ghosind/go-async"
This library is not stable yet, anything may change in the later versions.
For the following example, it runs the functions concurrently and returns the return values until all functions have been completed.
out, err := async.All(func (ctx context.Context) (int, error) {
return 0, nil
}, func () (string, error)) {
time.Sleep(100 * time.Millisecond)
return "hello", nil
})
// out: [][]any{{0, <nil>}, {"hello", <nil>}}
// err: <nil>
There are over 10 asynchronous control flow functions available, please visit Go Reference to see the documentation and examples.
The most of utility functions of this library accept any type of function to run, you can set the parameters and the return values as any type and any number of return values that you want. However, for best practice, we recommend you to set the first parameter as context.Context
to receive the signals and make the type of the last return value as an error to let the utilities know whether an error happened or not.
For all functions, you can use the XXXWithContext
function (like AllWithContext
, RaceWithContext
, ...) to set the context by yourself.
All
AllCompleted
Forever
Parallel
ParallelCompleted
Race
Retry
Seq
SeqGroups
Series
Times
TimesLimit
TimesSeries
Until
While
The library published under MIT License, please see license file for more details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.