Skip to content

Commit

Permalink
fix: golint
Browse files Browse the repository at this point in the history
  • Loading branch information
OldTyT committed Feb 3, 2024
1 parent a27238a commit edc7787
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
17 changes: 8 additions & 9 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package config
import (
"os"
"strconv"
"strings"
)

// const Version string = "v0.0.1"
Expand Down Expand Up @@ -87,14 +86,14 @@ func getEnvAsBool(name string, defaultVal bool) bool {
}

// Helper to read an environment variable into a string slice or return default value
func getEnvAsSlice(name string, defaultVal []string, sep string) []string {
valStr := getEnv(name, "")
// func getEnvAsSlice(name string, defaultVal []string, sep string) []string {
// valStr := getEnv(name, "")

if valStr == "" {
return defaultVal
}
// if valStr == "" {
// return defaultVal
// }

val := strings.Split(valStr, sep)
// val := strings.Split(valStr, sep)

return val
}
// return val
// }
5 changes: 2 additions & 3 deletions internal/frigate/frigate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"reflect"
Expand Down Expand Up @@ -144,7 +143,7 @@ func GetEvents(FrigateURL string, bot *tgbotapi.BotAPI, SetBefore bool) EventsSt
}

// Read data from response
byteValue, err := ioutil.ReadAll(resp.Body)
byteValue, err := io.ReadAll(resp.Body)
if err != nil {
ErrorSend("Can't read JSON: "+err.Error(), bot, "ALL")
}
Expand Down Expand Up @@ -242,7 +241,7 @@ func SendMessageEvent(FrigateEvent EventStruct, bot *tgbotapi.BotAPI) {

videoInfo, err := os.Stat(FilePathClip)
if err != nil {
ErrorSend("Error receiving information about the clip file: ", err)
ErrorSend("Error receiving information about the clip file: "+err.Error(), bot, FrigateEvent.ID)
}

if videoInfo.Size() < 52428800 {
Expand Down
4 changes: 2 additions & 2 deletions internal/log/log.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package log

import (
"io/ioutil"
"io"
"log"
"os"

Expand All @@ -18,7 +18,7 @@ var (

func LogFunc() {
conf := config.New()
Trace = log.New(ioutil.Discard, "TRACE: ", log.Ldate|log.Ltime|log.Lshortfile)
Trace = log.New(io.Discard, "TRACE: ", log.Ldate|log.Ltime|log.Lshortfile)
file, err := os.OpenFile("/dev/null", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit edc7787

Please sign in to comment.