Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:recycle: Code style: deprecated elements (#17311)

Jeffrey Chen9a62f8ee8606
diff --git a/kernel/util/misc.go b/kernel/util/misc.go
index 36bd8d04d7..32d3b3f757 100644
--- a/kernel/util/misc.go
+++ b/kernel/util/misc.go
@@ -23,17 +23,12 @@ import (
"regexp"
"strconv"
"strings"
- "time"
"unicode"
"github.com/88250/lute/html"
"github.com/siyuan-note/logging"
)
-func init() {
- rand.Seed(time.Now().UTC().UnixNano())
-}
-
func GetDuplicateName(master string) (ret string) {
if "" == master {
return
diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go
index 6ddeff3ea7..8eccc1b7c2 100644
--- a/kernel/util/runtime.go
+++ b/kernel/util/runtime.go
@@ -18,10 +18,10 @@ package util
import (
"bytes"
+ "crypto/rand"
"fmt"
"io"
"io/fs"
- "math/rand"
"os"
"path/filepath"
"runtime"
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 067a3b3ca1..febe09360c 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -20,7 +20,6 @@ import (
"errors"
"flag"
"fmt"
- "math/rand"
"mime"
"net/http"
"net/url"
@@ -31,7 +30,6 @@ import (
"strings"
"sync"
"sync/atomic"
- "time"
"github.com/88250/go-humanize"
"github.com/88250/gulu"
@@ -86,7 +84,6 @@ func coalesceToEnvVar(fromCLI *string, envVarName string) *string {
func Boot() {
initEnvVars()
IncBootProgress(3, "Booting kernel...")
- rand.Seed(time.Now().UTC().UnixNano())
initMime()
initHttpClient()
diff --git a/kernel/util/working_mobile.go b/kernel/util/working_mobile.go
index 71ad1c9648..1ad58ef8f0 100644
--- a/kernel/util/working_mobile.go
+++ b/kernel/util/working_mobile.go
@@ -17,11 +17,9 @@
package util
import (
- "math/rand"
"os"
"path/filepath"
"runtime"
- "time"
"github.com/88250/gulu"
figure "github.com/common-nighthawk/go-figure"
@@ -32,7 +30,6 @@ import (
func BootMobile(container, appDir, workspaceBaseDir, lang string) {
IncBootProgress(3, "Booting kernel...")
- rand.Seed(time.Now().UTC().UnixNano())
initMime()
initHttpClient()
ServerPort = FixedPort