mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 07:26:47 +00:00
Bump golangci-lint to v1.24.0, linter fixes and general code improvements (#478)
* Bump golangci-lint version, update Go version deps and generic code improvements * Fix wesbocket resp nil check and zip closures * Update pprof path
This commit is contained in:
@@ -264,22 +264,19 @@ func ExtractPort(host string) int {
|
||||
|
||||
// OutputCSV dumps data into a file as comma-separated values
|
||||
func OutputCSV(filePath string, data [][]string) error {
|
||||
_, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
errTwo := ioutil.WriteFile(filePath, nil, 0770)
|
||||
if errTwo != nil {
|
||||
return errTwo
|
||||
}
|
||||
}
|
||||
|
||||
file, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
writer := csv.NewWriter(file)
|
||||
return writer.WriteAll(data)
|
||||
if err = writer.WriteAll(data); err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
file.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetURIPath returns the path of a URL given a URI
|
||||
|
||||
Reference in New Issue
Block a user