Skip to content

Commit

Permalink
Docs and go.mod update
Browse files Browse the repository at this point in the history
  • Loading branch information
neilotoole committed Mar 12, 2024
1 parent 570bb78 commit 15ca937
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ cat myfile.ext | typedetect
In this scenario, `typedetect` wants to detect
and print the type of data in the file/pipe, and then print the contents.
That detection sampling could be done in a separate goroutine per sampler type.
The input file could be, let's say, a JSON file or an XML file.
The input file could be, let's say, a JSON file, or an XML file.

The obvious approach is to inspect the first few tokens of the
input, and check if the tokens are either valid JSON or valid XML.
Expand Down Expand Up @@ -110,7 +110,9 @@ Read 12 bytes from stdin
- [`in-out-err`](./examples/in-out-err): copy `stdin` to both `stdout` and `stderr`.
- [`typedetect`](./examples/typedetect): detect the type of input data, and print the head and tail
of the contents.
![streamcache_typedetect.png](examples/typedetect/streamcache_typedetect.png)
- [`multicase`](./examples/multicase): transform each line of input to upper, lower, and title case.
![streamcache_multicase.png](examples/multicase/streamcache_multicase.png)

## Related work

Expand Down
1 change: 1 addition & 0 deletions examples/multicase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ $ go install github.com/neilotoole/streamcache/examples/multicase
$ echo "hello world" | multicase
```

![streamcache_multicase.png](streamcache_multicase.png)
Binary file added examples/multicase/streamcache_multicase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/typedetect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ $ typedetect testdata/data.json
$ cat testdata/data.xml | typedetect
```

![streamcache_typedetect.png](streamcache_typedetect.png)
Binary file added examples/typedetect/streamcache_typedetect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
module github.com/neilotoole/streamcache

// Minimum version 1.20 because that's when context.Cause was introduced.
go 1.21

toolchain go1.21.6
toolchain go1.22.1

require (
github.com/neilotoole/fifomu v0.1.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/neilotoole/fifomu v0.1.1 h1:S6stULFbK9/ZWjbcgZjxhlmXNg1P2IB7AisEfk/Aa
github.com/neilotoole/fifomu v0.1.1/go.mod h1:eQEVNCI1Ur9GPyv7oRhtNjEWd4bhaxxNCFB+jLv06e0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
8 changes: 2 additions & 6 deletions streamcache_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
"sync/atomic"
"testing"

"github.com/neilotoole/streamcache"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/neilotoole/streamcache"
)

// BenchmarkDevelop is used during development as a standard benchmark
Expand Down Expand Up @@ -247,14 +248,9 @@ func cond[T any](cond bool, a, b T) T {
var rdrCounts = []int{
1,
2,
// 3,
// 4,
7,
// 16,
93,
// 531 ,
17001,
// 93125,
}

const (
Expand Down

0 comments on commit 15ca937

Please sign in to comment.