New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/kogutich/go-async

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/kogutich/go-async

  • v0.0.0-20240707172239-89a7e3e5e40e
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-async

Library that provides promise-like functionality for running functions asynchronously.

Usage

Imagine a function that takes some time to complete.
And we want to run it asynchronously and later take the results.

f := func() (string, error) {
    time.Sleep(time.Second)
    return "Hello world", nil
}
  1. Start a function and save the promise (under the hood it runs in a separate goroutine):
promise := async.RunVE(f)
  1. Wait for results:
value, err := promise.Wait()

Naming

RunVE means we run function that returns Value and Error.
Supported functions described here. Each function type has its own Run* method.

FAQs

Package last updated on 07 Jul 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc