Skip to content

Commit

Permalink
refactor: refactor WriteRecord function in write.go file
Browse files Browse the repository at this point in the history
- Remove unused imports in `write.go`
- Refactor `WriteRecord` function to use `fmt.Sprintf` instead of `cases.Title` and `strings.ReplaceAll`

Signed-off-by: Corentin Barreau <[email protected]>
  • Loading branch information
CorentinB committed Jun 23, 2023
1 parent 9b88877 commit 6e5bb31
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions write.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (

"github.com/klauspost/compress/gzip"
"github.com/klauspost/pgzip"
"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/klauspost/compress/zstd"
uuid "github.com/satori/go.uuid"
Expand Down Expand Up @@ -87,9 +85,7 @@ func (w *Writer) WriteRecord(r *Record) (recordID string, err error) {
}

for key, value := range r.Header {
titleCaser := cases.Title(language.English)
value := strings.ReplaceAll(titleCaser.String(key)+": "+value+"\r\n", "Warc", "WARC")
if _, err := io.WriteString(w.FileWriter, value); err != nil {
if _, err := io.WriteString(w.FileWriter, fmt.Sprintf("%s: %s\r\n", key, value)); err != nil {
return recordID, err
}
}
Expand Down

0 comments on commit 6e5bb31

Please sign in to comment.