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 {
pname = "mcchunkie";
version = "v1.0.15";
version = "v1.0.16";
src = ./.;
vendorHash = "sha256-LMWaHqmvxG17Z0zh0vmTAYDsc9UkztSCM1+jl2iXSds=";

View File

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

View File

@ -3,7 +3,6 @@ package plugins
import (
"math/rand"
"regexp"
"time"
"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))]
}

View File

@ -3,7 +3,6 @@ package plugins
import (
"math/rand"
"regexp"
"time"
"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))]
}
// RespondText to groan events

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,6 @@ import (
"bytes"
"encoding/gob"
"fmt"
"io/ioutil"
"log"
"os"
"path"
@ -53,7 +52,7 @@ func (s *FStore) decodeRoom(room []byte) (*gomatrix.Room, error) {
// Set dumps value into a file named key
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 {
log.Println(err)
}
@ -61,7 +60,7 @@ func (s FStore) Set(key string, value string) {
// Get pulls value from a file named key
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 {
return "", nil
}