diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-30 22:06:46 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-30 23:05:17 -0700 |
commit | fffb8ca73af4fd9e1df353ccf779e89fe097d8ce (patch) | |
tree | 745da4f3d17c5069ea061d731eb6faaa9d86590f /cmd/btrfs-rec/util.go | |
parent | 86063b41fc1a235930d6c79e6b7cd38ae8d8c147 (diff) |
Upgrade to lowmemjson v0.3.0
Diffstat (limited to 'cmd/btrfs-rec/util.go')
-rw-r--r-- | cmd/btrfs-rec/util.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/btrfs-rec/util.go b/cmd/btrfs-rec/util.go index 3c72cae..3d751a6 100644 --- a/cmd/btrfs-rec/util.go +++ b/cmd/btrfs-rec/util.go @@ -38,13 +38,12 @@ func readJSONFile[T any](ctx context.Context, filename string) (T, error) { return ret, nil } -func writeJSONFile(w io.Writer, obj any, cfg lowmemjson.ReEncoder) (err error) { +func writeJSONFile(w io.Writer, obj any, cfg lowmemjson.ReEncoderConfig) (err error) { buffer := bufio.NewWriter(w) defer func() { if _err := buffer.Flush(); err == nil && _err != nil { err = _err } }() - cfg.Out = buffer - return lowmemjson.NewEncoder(&cfg).Encode(obj) + return lowmemjson.NewEncoder(lowmemjson.NewReEncoder(buffer, cfg)).Encode(obj) } |