Skip to content

Commit

Permalink
fix(tutorial): avoid broken pipe caused by passing non-JSON to jq (#1193
Browse files Browse the repository at this point in the history
)

Following the tutorial code results in a broken pipe. This is a simple
fixup that adds a call to tail so that jq is only given valid input.
  • Loading branch information
imw authored Aug 22, 2023
1 parent cc8f002 commit 23059b6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/tutorial/experiment/torsf/chapter01/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func main() {
// You can now run this code as follows:
//
// ```
// $ go run ./experiment/torsf/chapter01 | jq
// $ go run ./experiment/torsf/chapter01 | tail -n 1 | jq
// [snip]
// {
// "data_format_version": "",
Expand Down
2 changes: 1 addition & 1 deletion internal/tutorial/experiment/torsf/chapter03/torsf.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (m *Measurer) run(ctx context.Context,
// It's now time to run the new code we've written:
//
// ```
// $ go run ./experiment/torsf/chapter03 | jq
// $ go run ./experiment/torsf/chapter03 | tail -n 1 | jq
// 2021/06/21 21:21:18 info [ 0.1%] torsf experiment is running
// 2021/06/21 21:21:19 info [ 0.2%] torsf experiment is running
// [...]
Expand Down
2 changes: 1 addition & 1 deletion internal/tutorial/experiment/torsf/chapter04/torsf.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (m *Measurer) run(ctx context.Context,
// We can now run the code as follows to obtain:
//
// ```
// $ go run ./experiment/torsf/chapter04 | jq
// $ go run ./experiment/torsf/chapter04 | tail -n 1 | jq
// [...]
// Jun 21 23:40:50.000 [notice] Bootstrapped 100% (done): Done
// 2021/06/21 23:40:50 info [100.0%] torsf experiment is finished
Expand Down

0 comments on commit 23059b6

Please sign in to comment.