fix staticcheck warnings

bump to 1.0.16
This commit is contained in:
Aaron Bieber 2024-03-29 07:23:06 -06:00
parent 377b99bd44
commit c240a36b21
No known key found for this signature in database
9 changed files with 7 additions and 20 deletions

View File

@ -23,7 +23,7 @@
{ {
mcchunkie = pkgs.buildGoModule rec { mcchunkie = pkgs.buildGoModule rec {
pname = "mcchunkie"; pname = "mcchunkie";
version = "v1.0.15"; version = "v1.0.16";
src = ./.; src = ./.;
vendorHash = "sha256-LMWaHqmvxG17Z0zh0vmTAYDsc9UkztSCM1+jl2iXSds="; vendorHash = "sha256-LMWaHqmvxG17Z0zh0vmTAYDsc9UkztSCM1+jl2iXSds=";

View File

@ -95,7 +95,6 @@ func (h *Beer) pretty(b BeerResp, random bool) string {
idx := 0 idx := 0
if random { if random {
rand.Seed(time.Now().Unix())
idx = rand.Intn(len(b.Records)) idx = rand.Intn(len(b.Records))
} }

View File

@ -3,7 +3,6 @@ package plugins
import ( import (
"math/rand" "math/rand"
"regexp" "regexp"
"time"
"github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrix"
) )
@ -40,7 +39,6 @@ func (h *BotSnack) Process(from, msg string) string {
"=.=", "=.=",
} }
rand.Seed(time.Now().Unix())
return a[rand.Intn(len(a))] return a[rand.Intn(len(a))]
} }

View File

@ -3,7 +3,6 @@ package plugins
import ( import (
"math/rand" "math/rand"
"regexp" "regexp"
"time"
"github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrix"
) )
@ -41,9 +40,7 @@ func (h *Groan) Process(_, _ string) string {
"........", "........",
} }
rand.Seed(time.Now().Unix())
return a[rand.Intn(len(a))] return a[rand.Intn(len(a))]
} }
// RespondText to groan events // RespondText to groan events

View File

@ -3,7 +3,7 @@ package plugins
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io"
"log" "log"
"net/http" "net/http"
"regexp" "regexp"
@ -48,7 +48,7 @@ func (h *Homestead) get(loc string) (*HomesteadResp, error) {
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -3,7 +3,6 @@ package plugins
import ( import (
"math/rand" "math/rand"
"regexp" "regexp"
"time"
"github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrix"
) )
@ -38,9 +37,7 @@ func (h *LoveYou) Process(from, post string) string {
"hawkard!", "hawkard!",
} }
rand.Seed(time.Now().Unix())
return a[rand.Intn(len(a))] return a[rand.Intn(len(a))]
} }
// SetStore we don't need a store, so just return // SetStore we don't need a store, so just return

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"math/rand" "math/rand"
"regexp" "regexp"
"time"
"github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrix"
) )
@ -43,8 +42,6 @@ func (h *Thanks) Process(from, post string) string {
fmt.Sprintf("you're welcome, %s", s), fmt.Sprintf("you're welcome, %s", s),
} }
rand.Seed(time.Now().Unix())
return a[rand.Intn(len(a))] return a[rand.Intn(len(a))]
} }

View File

@ -3,7 +3,7 @@ package plugins
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"net/url" "net/url"
"regexp" "regexp"
@ -127,7 +127,7 @@ func (h *Weather) get(loc string) (*WeatherResp, error) {
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -4,7 +4,6 @@ import (
"bytes" "bytes"
"encoding/gob" "encoding/gob"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os" "os"
"path" "path"
@ -53,7 +52,7 @@ func (s *FStore) decodeRoom(room []byte) (*gomatrix.Room, error) {
// Set dumps value into a file named key // Set dumps value into a file named key
func (s FStore) Set(key string, value string) { func (s FStore) Set(key string, value string) {
err := ioutil.WriteFile(path.Join(string(s), key), []byte(value), 0600) err := os.WriteFile(path.Join(string(s), key), []byte(value), 0600)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} }
@ -61,7 +60,7 @@ func (s FStore) Set(key string, value string) {
// Get pulls value from a file named key // Get pulls value from a file named key
func (s FStore) Get(key string) (string, error) { func (s FStore) Get(key string) (string, error) {
data, err := ioutil.ReadFile(path.Join(string(s), key)) data, err := os.ReadFile(path.Join(string(s), key))
if err != nil { if err != nil {
return "", nil return "", nil
} }