Last active
May 19, 2022 09:53
-
-
Save cideM/b2c52e61112f7f45d53f2ec03718b8ab to your computer and use it in GitHub Desktop.
The new main function with generics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
source := []string{"FOO", "BAR", "BAX"} | |
ctx, cancel := context.WithCancel(context.Background()) | |
defer cancel() | |
readStream, err := producer(ctx, source) | |
if err != nil { | |
log.Fatal(err) | |
} | |
step1results, step1errors := step(ctx, readStream, transformA) | |
step2results, step2errors := step(ctx, step1results, transformB) | |
allErrors := Merge(ctx, step1errors, step2errors) | |
sink(ctx, cancel, step2results, allErrors) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment