Skip to content

Commit

Permalink
refactor(export): replace magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Nov 4, 2022
1 parent a3f0d35 commit 74b845f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/chat/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/iyear/tdl/pkg/utils"
"github.com/jedib0t/go-pretty/v6/progress"
"golang.org/x/time/rate"
"io"
"os"
"time"
)
Expand Down Expand Up @@ -77,7 +78,7 @@ func Export(ctx context.Context, chat string, from, to int, output string, _time
return err
}
defer func(f *os.File) {
_, _ = f.Seek(-1, 2)
_, _ = f.Seek(-1, io.SeekEnd) // overwrite last comma
_, _ = f.WriteString("]}")
}(f)

Expand Down

0 comments on commit 74b845f

Please sign in to comment.