Skip to content

Commit b650447

Browse files
committed
Fix linter
1 parent 22f48c5 commit b650447

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

cmd/serve_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ import (
1717
"heckel.io/ntfy/v2/util"
1818
)
1919

20-
func init() {
21-
rand.Seed(time.Now().UnixMilli())
22-
}
23-
2420
func TestCLI_Serve_Unix_Curl(t *testing.T) {
2521
sockFile := filepath.Join(t.TempDir(), "ntfy.sock")
2622
configFile := newEmptyFile(t) // Avoid issues with existing server.yml file on system

server/server_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package server
33
import (
44
"bufio"
55
"context"
6+
"crypto/rand"
67
"encoding/base64"
78
"encoding/json"
89
"fmt"
910
"golang.org/x/crypto/bcrypt"
1011
"heckel.io/ntfy/v2/user"
1112
"io"
12-
"math/rand"
1313
"net/http"
1414
"net/http/httptest"
1515
"net/netip"

server/topic_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestTopic_Subscribe_DuplicateID(t *testing.T) {
6969
t.Parallel()
7070
to := newTopic("mytopic")
7171

72-
// Fix random seed to force same number generation
72+
//lint:ignore SA1019 Fix random seed to force same number generation
7373
rand.Seed(1)
7474
a := rand.Int()
7575
to.subscribers[a] = &topicSubscriber{
@@ -82,7 +82,7 @@ func TestTopic_Subscribe_DuplicateID(t *testing.T) {
8282
return nil
8383
}
8484

85-
// Force rand.Int to generate the same id once more
85+
//lint:ignore SA1019 Force rand.Int to generate the same id once more
8686
rand.Seed(1)
8787
id := to.Subscribe(subFn, "b", func() {})
8888
res := to.subscribers[id]

test/server.go

-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ import (
77
"net/http"
88
"path/filepath"
99
"testing"
10-
"time"
1110
)
1211

13-
func init() {
14-
rand.Seed(time.Now().UnixMilli())
15-
}
16-
1712
// StartServer starts a server.Server with a random port and waits for the server to be up
1813
func StartServer(t *testing.T) (*server.Server, int) {
1914
return StartServerWithConfig(t, server.NewConfig())

0 commit comments

Comments
 (0)