Skip to content

Commit

Permalink
feat(go): add util func to pretty print CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelVallenet committed Apr 6, 2023
1 parent e87b3be commit 158beab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions go/cmd/pathwar/util.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"bytes"
"context"
"encoding/csv"
"encoding/json"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -205,3 +207,10 @@ func initSentryFromEnv(startMessage string) (func(), error) {
}
return cleanup, nil
}

func prettyCSV(data [][]string) string {

Check failure on line 211 in go/cmd/pathwar/util.go

View workflow job for this annotation

GitHub Actions / golangci-lint

`prettyCSV` is unused (deadcode)
var buf bytes.Buffer
w := csv.NewWriter(&buf)
w.WriteAll(data)

Check failure on line 214 in go/cmd/pathwar/util.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `w.WriteAll` is not checked (errcheck)
return buf.String()
}

0 comments on commit 158beab

Please sign in to comment.