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
package main | |
import ( | |
"context" | |
"errors" | |
"log" | |
"strings" | |
"sync" | |
"time" |
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
package main | |
import ( | |
"context" | |
"errors" | |
"log" | |
"runtime" | |
"strings" | |
"sync" | |
"time" |
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
{ | |
description = "zola"; | |
inputs.flake-utils.url = "github:numtide/flake-utils"; | |
inputs.nixpkgs.url = "github:nixos/nixpkgs/staging-next"; | |
inputs.ankisrc.url = "https://github.com/ankitects/anki/releases/download/2.1.35/anki-2.1.35-linux-amd64.tar.bz2"; | |
inputs.ankisrc.flake = false; | |
outputs = { self, nixpkgs, flake-utils, ankisrc }: | |
flake-utils.lib.eachDefaultSystem (system: |
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) | |
} |
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 step[In any, Out any]( | |
ctx context.Context, | |
inputChannel <-chan In, | |
fn func(In) (Out, error), | |
) (chan Out, chan error) { | |
outputChannel := make(chan Out) | |
errorChannel := make(chan error) | |
limit := int64(2) | |
// Use all CPU cores to maximize efficiency. We'll set the limit to 2 so you |
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() | |
inputChannel, err := producer(ctx, source) | |
if err != nil { | |
log.Fatal(err) | |
} |
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
diff --git a/main.go b/main.go | |
index b850a16..6745855 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -121,7 +121,7 @@ func main() { | |
errors = append(errors, lowerCaseErrors) | |
} | |
- stage1Merged := mergeStringChans(ctx, stage1Channels...) | |
+ stage1Merged := mergeChans(ctx, stage1Channels...) |
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
diff --git a/main.go b/main.go | |
index 3888a36..8794caa 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -2,6 +2,7 @@ package main | |
import ( | |
"context" | |
+ "errors" | |
"log" |
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
diff --git a/main.go b/main.go | |
index c45418b..dd7d1ef 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -31,9 +31,10 @@ func sink(ctx context.Context, values <-chan string) { | |
log.Print(ctx.Err().Error()) | |
return | |
case val, ok := <-values: | |
- log.Println(val) | |
if ok { |
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
diff --git a/main.go b/main.go | |
index 08d7580..c45418b 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -31,6 +31,7 @@ func sink(ctx context.Context, values <-chan string) { | |
log.Print(ctx.Err().Error()) | |
return | |
case val, ok := <-values: | |
+ log.Println(val) | |
if ok { |
NewerOlder