From 8bc40486f8c9069efc118fe80fe10507c1b0c5d1 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 27 Jan 2022 14:58:31 -0800 Subject: [PATCH] Quiet, linter --- core/chat/persistence.go | 1 + core/data/data.go | 2 +- core/offlineState.go | 2 +- core/playlist/writer.go | 2 +- core/transcoder/fileWriterReceiverService.go | 5 ++--- utils/backup.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/chat/persistence.go b/core/chat/persistence.go index 315a3de5b..684e27240 100644 --- a/core/chat/persistence.go +++ b/core/chat/persistence.go @@ -326,6 +326,7 @@ func saveMessageVisibility(messageIDs []string, visible bool) error { return err } + //nolint:gosec stmt, err := tx.Prepare("UPDATE messages SET hidden_at=? WHERE id IN (?" + strings.Repeat(",?", len(messageIDs)-1) + ")") if err != nil { return err diff --git a/core/data/data.go b/core/data/data.go index f233d542c..336250aae 100644 --- a/core/data/data.go +++ b/core/data/data.go @@ -52,7 +52,7 @@ func SetupPersistence(file string) error { if !utils.DoesFileExists(file) { log.Traceln("Creating new database at", file) - _, err := os.Create(file) + _, err := os.Create(file) //nolint: gosec if err != nil { log.Fatal(err.Error()) } diff --git a/core/offlineState.go b/core/offlineState.go index 84c823f14..3ae512d04 100644 --- a/core/offlineState.go +++ b/core/offlineState.go @@ -82,7 +82,7 @@ func createEmptyOfflinePlaylist(playlistFilePath string, offlineFilename string) } p.Close() - f, err := os.Create(playlistFilePath) + f, err := os.Create(playlistFilePath) //nolint:gosec if err != nil { log.Errorln(err) } diff --git a/core/playlist/writer.go b/core/playlist/writer.go index a15e71040..2df95f3fc 100644 --- a/core/playlist/writer.go +++ b/core/playlist/writer.go @@ -4,7 +4,7 @@ import "os" // WritePlaylist writes the playlist to disk. func WritePlaylist(data string, filePath string) error { - f, err := os.Create(filePath) + f, err := os.Create(filePath) //nolint:gosec if err != nil { return err } diff --git a/core/transcoder/fileWriterReceiverService.go b/core/transcoder/fileWriterReceiverService.go index e974cc08d..d5dbdc361 100644 --- a/core/transcoder/fileWriterReceiverService.go +++ b/core/transcoder/fileWriterReceiverService.go @@ -4,12 +4,11 @@ import ( "bytes" "io" "net" + "net/http" "os" "path/filepath" "strings" - "net/http" - "github.com/owncast/owncast/config" "github.com/owncast/owncast/utils" log "github.com/sirupsen/logrus" @@ -67,7 +66,7 @@ func (s *FileWriterReceiverService) uploadHandler(w http.ResponseWriter, r *http _, _ = io.Copy(&buf, r.Body) data := buf.Bytes() - f, err := os.Create(writePath) + f, err := os.Create(writePath) //nolint: gosec if err != nil { returnError(err, w) return diff --git a/utils/backup.go b/utils/backup.go index f960a7157..207da64db 100644 --- a/utils/backup.go +++ b/utils/backup.go @@ -39,7 +39,7 @@ func Restore(backupFile string, databaseFile string) error { rawSQL := b.String() - if _, err := os.Create(databaseFile); err != nil { + if _, err := os.Create(databaseFile); err != nil { //nolint: gosec return errors.New("unable to write restored database") }