fix: 🚑 Ignore useless error

This commit is contained in:
BuyMyMojo 2022-07-21 01:32:11 +10:00
parent f627e97bb1
commit b3f48957b1

View file

@ -1,13 +1,16 @@
package main package main
import ( import (
"bytes"
"encoding/csv" "encoding/csv"
"errors" "errors"
"flag" "flag"
"fmt" "fmt"
"io"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"strings"
) )
// Variables used for command line parameters // Variables used for command line parameters
@ -79,7 +82,7 @@ func process(CsvPath string) {
// Read CSV file // Read CSV file
lines, err := ReadCsv(CsvOutput) lines, err := ReadCsv(CsvOutput)
if err != nil { if err != nil {
panic(err) return
} }
// Loop through lines & add to DiscordIDs list // Loop through lines & add to DiscordIDs list
@ -160,11 +163,21 @@ func ReadCsv(filename string) ([][]string, error) {
} }
defer f.Close() defer f.Close()
var x string var buf bytes.Buffer
f.WriteString(x) io.Copy(&buf, f)
x := string(buf.Bytes())
strings.ReplaceAll(x, "\r\n", "\n")
strings.ReplaceAll(x, "\r\n", " ")
reader := csv.NewReader(strings.NewReader(x))
reader.ReuseRecord = true
// Read File into a Variable // Read File into a Variable
lines, err := csv.NewReader(f).ReadAll() lines, err := reader.ReadAll()
if err != nil { if err != nil {
return [][]string{}, err return [][]string{}, err
} }