summaryrefslogtreecommitdiff
path: root/data/datasource_stdin.go
diff options
context:
space:
mode:
Diffstat (limited to 'data/datasource_stdin.go')
-rw-r--r--data/datasource_stdin.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/data/datasource_stdin.go b/data/datasource_stdin.go
deleted file mode 100644
index 13bb5fa4..00000000
--- a/data/datasource_stdin.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package data
-
-import (
- "context"
- "fmt"
- "io"
- "os"
-)
-
-func readStdin(ctx context.Context, _ *Source, _ ...string) ([]byte, error) {
- stdin := stdinFromContext(ctx)
-
- b, err := io.ReadAll(stdin)
- if err != nil {
- return nil, fmt.Errorf("can't read %s: %w", stdin, err)
- }
- return b, nil
-}
-
-type stdinCtxKey struct{}
-
-func ContextWithStdin(ctx context.Context, r io.Reader) context.Context {
- return context.WithValue(ctx, stdinCtxKey{}, r)
-}
-
-func stdinFromContext(ctx context.Context) io.Reader {
- if r, ok := ctx.Value(stdinCtxKey{}).(io.Reader); ok {
- return r
- }
-
- return os.Stdin
-}