From f355512aa698df5334a253a3b1d8376dc0555c92 Mon Sep 17 00:00:00 2001 From: Alexey Dolotov Date: Sat, 28 Mar 2026 22:59:32 +0300 Subject: [PATCH] fix: address staticcheck lint issues - avoid deprecated DefaultIdleTimeout, use time.Minute directly - simplify embedded field selectors (QF1008) --- internal/cli/run_proxy.go | 3 ++- mtglib/conns.go | 4 ++-- mtglib/proxy_opts.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/cli/run_proxy.go b/internal/cli/run_proxy.go index 8eabc3d..c57374b 100644 --- a/internal/cli/run_proxy.go +++ b/internal/cli/run_proxy.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "os" + "time" "github.com/9seconds/mtg/v2/antireplay" "github.com/9seconds/mtg/v2/events" @@ -262,7 +263,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen AllowFallbackOnUnknownDC: conf.AllowFallbackOnUnknownDC.Get(false), TolerateTimeSkewness: conf.TolerateTimeSkewness.Value, - IdleTimeout: conf.Network.Timeout.Idle.Get(mtglib.DefaultIdleTimeout), + IdleTimeout: conf.Network.Timeout.Idle.Get(time.Minute), DoppelGangerURLs: doppelGangerURLs, DoppelGangerPerRaid: conf.Defense.Doppelganger.Repeats.Get(mtglib.DoppelGangerPerRaid), diff --git a/mtglib/conns.go b/mtglib/conns.go index e3b60e8..12f19d1 100644 --- a/mtglib/conns.go +++ b/mtglib/conns.go @@ -104,13 +104,13 @@ type connIdleTimeout struct { } func (c connIdleTimeout) Read(b []byte) (int, error) { - c.Conn.SetReadDeadline(time.Now().Add(c.timeout)) //nolint: errcheck + c.SetReadDeadline(time.Now().Add(c.timeout)) //nolint: errcheck return c.Conn.Read(b) //nolint: wrapcheck } func (c connIdleTimeout) Write(b []byte) (int, error) { - c.Conn.SetWriteDeadline(time.Now().Add(c.timeout)) //nolint: errcheck + c.SetWriteDeadline(time.Now().Add(c.timeout)) //nolint: errcheck return c.Conn.Write(b) //nolint: wrapcheck } diff --git a/mtglib/proxy_opts.go b/mtglib/proxy_opts.go index beea1c6..102b279 100644 --- a/mtglib/proxy_opts.go +++ b/mtglib/proxy_opts.go @@ -218,7 +218,7 @@ func (p ProxyOpts) getPreferIP() string { func (p ProxyOpts) getIdleTimeout() time.Duration { if p.IdleTimeout == 0 { - return DefaultIdleTimeout + return time.Minute } return p.IdleTimeout