From b8d2051e64e635aa0aac2fcfa0962ee0da195b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 14 Feb 2026 00:16:52 +0800 Subject: [PATCH] feat: update go1.26 --- go.mod | 4 ++-- go.sum | 4 ++-- internal/service/toolbox_migration.go | 21 +++++++-------------- pkg/firewall/firewall.go | 3 +-- pkg/shell/pty.go | 3 +-- pkg/ssh/ssh.go | 3 +-- 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index a9e33d04..962ffe34 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/acepanel/panel -go 1.25.6 +go 1.26.0 require ( github.com/DeRuina/timberjack v1.3.9 @@ -25,7 +25,7 @@ require ( github.com/hashicorp/go-version v1.8.0 github.com/leonelquinteros/gotext v1.7.2 github.com/lib/pq v1.11.2 - github.com/libdns/alidns v1.0.6-beta.3.0.20260121104221-597b1e580e21 + github.com/libdns/alidns v1.0.6 github.com/libdns/cloudflare v0.2.2 github.com/libdns/cloudns v1.1.0 github.com/libdns/gcore v0.0.0-20250427050847-9964da923833 diff --git a/go.sum b/go.sum index 3b35d9bb..ccc6df1a 100644 --- a/go.sum +++ b/go.sum @@ -213,8 +213,8 @@ github.com/leonelquinteros/gotext v1.7.2 h1:bDPndU8nt+/kRo1m4l/1OXiiy2v7Z7dfPQ9+ github.com/leonelquinteros/gotext v1.7.2/go.mod h1:9/haCkm5P7Jay1sxKDGJ5WIg4zkz8oZKw4ekNpALob8= github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs= github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= -github.com/libdns/alidns v1.0.6-beta.3.0.20260121104221-597b1e580e21 h1:BGtptgrEJGjDQz63r4xkcQ/2ERXpna9WVUtrTtmW8d0= -github.com/libdns/alidns v1.0.6-beta.3.0.20260121104221-597b1e580e21/go.mod h1:RECwyQ88e9VqQVtSrvX76o1ux3gQUKGzMgxICi+u7Ec= +github.com/libdns/alidns v1.0.6 h1:/Ii428ty6WHFJmE24rZxq2taq++gh7rf9jhgLfp8PmM= +github.com/libdns/alidns v1.0.6/go.mod h1:RECwyQ88e9VqQVtSrvX76o1ux3gQUKGzMgxICi+u7Ec= github.com/libdns/cloudflare v0.2.2 h1:XWHv+C1dDcApqazlh08Q6pjytYLgR2a+Y3xrXFu0vsI= github.com/libdns/cloudflare v0.2.2/go.mod h1:w9uTmRCDlAoafAsTPnn2nJ0XHK/eaUMh86DUk8BWi60= github.com/libdns/cloudns v1.1.0 h1:W+1MadtxKySn3b5RITFTsXgTIvr5VoO5x97cewjlDcs= diff --git a/internal/service/toolbox_migration.go b/internal/service/toolbox_migration.go index 45fc18af..5dc4f942 100644 --- a/internal/service/toolbox_migration.go +++ b/internal/service/toolbox_migration.go @@ -262,18 +262,16 @@ func (s *ToolboxMigrationService) Start(w http.ResponseWriter, r *http.Request) return } - now := time.Now() s.state.Step = types.MigrationStepRunning s.state.Items = req s.state.Results = nil s.state.Logs = nil - s.state.StartedAt = &now + s.state.StartedAt = new(time.Now()) s.state.EndedAt = nil - conn := *s.state.Connection s.state.mu.Unlock() // 异步执行迁移 - go s.runMigration(&conn, req) + go s.runMigration(new(*s.state.Connection), req) Success(w, nil) } @@ -412,10 +410,9 @@ func (s *ToolboxMigrationService) runMigration(conn *request.ToolboxMigrationCon s.migrateProject(conn, &proj, items.StopOnMig) } - now := time.Now() s.state.mu.Lock() s.state.Step = types.MigrationStepDone - s.state.EndedAt = &now + s.state.EndedAt = new(time.Now()) s.state.mu.Unlock() s.addLog("===== " + s.t.Get("Migration completed") + " =====") @@ -428,8 +425,7 @@ func (s *ToolboxMigrationService) migrateWebsite(conn *request.ToolboxMigrationC Name: site.Name, Status: types.MigrationItemRunning, } - now := time.Now() - result.StartedAt = &now + result.StartedAt = new(time.Now()) s.addResult(result) s.addLog(fmt.Sprintf("[%s] %s: %s", s.t.Get("Website"), s.t.Get("start migrating"), site.Name)) @@ -504,8 +500,7 @@ func (s *ToolboxMigrationService) migrateDatabase(conn *request.ToolboxMigration Name: displayName, Status: types.MigrationItemRunning, } - now := time.Now() - result.StartedAt = &now + result.StartedAt = new(time.Now()) s.addResult(result) s.addLog(fmt.Sprintf("[%s] %s: %s", s.t.Get("Database"), s.t.Get("start migrating"), displayName)) @@ -619,8 +614,7 @@ func (s *ToolboxMigrationService) migrateDatabaseUser(conn *request.ToolboxMigra Name: displayName, Status: types.MigrationItemRunning, } - now := time.Now() - result.StartedAt = &now + result.StartedAt = new(time.Now()) s.addResult(result) s.addLog(fmt.Sprintf("[%s] %s: %s", s.t.Get("Database User"), s.t.Get("start migrating"), displayName)) @@ -700,8 +694,7 @@ func (s *ToolboxMigrationService) migrateProject(conn *request.ToolboxMigrationC Name: proj.Name, Status: types.MigrationItemRunning, } - now := time.Now() - result.StartedAt = &now + result.StartedAt = new(time.Now()) s.addResult(result) s.addLog(fmt.Sprintf("[%s] %s: %s", s.t.Get("Project"), s.t.Get("start migrating"), proj.Name)) diff --git a/pkg/firewall/firewall.go b/pkg/firewall/firewall.go index 521e6b35..2cb96d04 100644 --- a/pkg/firewall/firewall.go +++ b/pkg/firewall/firewall.go @@ -84,8 +84,7 @@ func mergeRules(rules []FireInfo) []FireInfo { existing.Protocol = ProtocolTCPUDP } } else { - clone := r - grouped[key] = &clone + grouped[key] = new(r) order = append(order, key) } } diff --git a/pkg/shell/pty.go b/pkg/shell/pty.go index 9310327b..4caaf570 100644 --- a/pkg/shell/pty.go +++ b/pkg/shell/pty.go @@ -157,8 +157,7 @@ func (t *Turn) Resize(rows, cols uint16) error { // terminal which no longer has an open slave. So ignore error here. // See https://github.com/creack/pty/issues/21 func IsPTYError(err error) error { - var pathErr *os.PathError - if !errors.As(err, &pathErr) || !errors.Is(pathErr.Err, syscall.EIO) || !errors.Is(err, io.EOF) { + if pathErr, ok := errors.AsType[*os.PathError](err); !ok || !errors.Is(pathErr.Err, syscall.EIO) || !errors.Is(err, io.EOF) { return err } diff --git a/pkg/ssh/ssh.go b/pkg/ssh/ssh.go index fb44d177..5e60b691 100644 --- a/pkg/ssh/ssh.go +++ b/pkg/ssh/ssh.go @@ -85,8 +85,7 @@ func parseKey(key, passphrase string) (ssh.Signer, error) { signer, err := ssh.ParsePrivateKey(keyBytes) if err != nil { // 密钥被加密 - var passphraseMissingError *ssh.PassphraseMissingError - if errors.As(err, &passphraseMissingError) { + if passphraseMissingError, ok := errors.AsType[*ssh.PassphraseMissingError](err); ok { return nil, passphraseMissingError } return nil, err