https://github.com/voidwyrm-2/go-async
A library that implements asynchronous structures over gorountines
https://github.com/voidwyrm-2/go-async
async async-await asynchronous-programming go golang library
Last synced: 6 days ago
JSON representation
A library that implements asynchronous structures over gorountines
- Host: GitHub
- URL: https://github.com/voidwyrm-2/go-async
- Owner: voidwyrm-2
- License: apache-2.0
- Created: 2025-07-01T22:36:38.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-02T03:03:38.000Z (12 months ago)
- Last Synced: 2025-10-23T02:42:47.347Z (8 months ago)
- Topics: async, async-await, asynchronous-programming, go, golang, library
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# go-async
go-async implements asynchronous structures, like C#'s `Task`s, over Go's gorountines to allow program structuring more languages such as C# and JavaScript.
## Installation
Run `go get github.com/voidwyrm-2/go-async@latest` to add it to your project.
## Example
```go
package main
import (
"fmt"
"time"
"github.com/voidwyrm-2/go-async"
)
func main() {
p := goasync.NewTask(func() (struct{}, error) {
for i := range 4 {
time.Sleep(time.Second * 2)
fmt.Printf("async thing %d finished\n", i)
}
return struct{}{}, nil
})
p.Start()
fmt.Println("doing things...")
time.Sleep(time.Second)
fmt.Println("doing more things...")
time.Sleep(time.Second)
fmt.Println("doing the last things...")
time.Sleep(time.Second * 3)
fmt.Println("waiting for background processes")
p.Await()
fmt.Println("all done!")
}
```