fix: re-enable CI lint job and fix ~65 lint errors (partial)

Re-enable the golangci-lint job in CI (disabled Oct 2025), update to
Go 1.25 and golangci-lint-action v7. Fix errcheck, gosimple S1009,
staticcheck SA4031 and SA2001 errors across 54 files. Remaining ~39
lint errors will be addressed in follow-up commits.
This commit is contained in:
Houmgaor
2026-02-17 17:59:00 +01:00
parent d2b5bb72f8
commit 2a0e3e2c84
54 changed files with 200 additions and 212 deletions

View File

@@ -19,7 +19,7 @@ func TestMsgBinTargetedParseEmpty(t *testing.T) {
bf := byteframe.NewByteFrame()
bf.WriteUint16(0) // TargetCount = 0
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
m := &MsgBinTargeted{}
err := m.Parse(bf)
@@ -41,7 +41,7 @@ func TestMsgBinTargetedParseSingleTarget(t *testing.T) {
bf.WriteUint32(0x12345678) // TargetCharID
bf.WriteBytes([]byte{0xDE, 0xAD, 0xBE, 0xEF})
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
m := &MsgBinTargeted{}
err := m.Parse(bf)
@@ -71,7 +71,7 @@ func TestMsgBinTargetedParseMultipleTargets(t *testing.T) {
bf.WriteUint32(300)
bf.WriteBytes([]byte{0x01, 0x02, 0x03})
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
m := &MsgBinTargeted{}
err := m.Parse(bf)
@@ -130,7 +130,7 @@ func TestMsgBinTargetedRoundTrip(t *testing.T) {
}
// Parse
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
parsed := &MsgBinTargeted{}
err = parsed.Parse(bf)
if err != nil {
@@ -244,7 +244,7 @@ func TestMsgBinChatBuildParse(t *testing.T) {
}
// Parse
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
parsed := &MsgBinChat{}
err = parsed.Parse(bf)
if err != nil {
@@ -286,7 +286,7 @@ func TestMsgBinChatBuildParseJapanese(t *testing.T) {
}
// Parse
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
parsed := &MsgBinChat{}
err = parsed.Parse(bf)
if err != nil {
@@ -318,7 +318,7 @@ func TestMsgBinChatBuildParseEmpty(t *testing.T) {
}
// Parse
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
parsed := &MsgBinChat{}
err = parsed.Parse(bf)
if err != nil {
@@ -386,7 +386,7 @@ func TestMsgBinChatAllTypes(t *testing.T) {
t.Fatalf("Build() error = %v", err)
}
bf.Seek(0, 0)
_, _ = bf.Seek(0, 0)
parsed := &MsgBinChat{}
err = parsed.Parse(bf)
if err != nil {

View File

@@ -132,7 +132,10 @@ func (cc *CryptConn) SendPacket(data []byte) error {
return err
}
cc.conn.Write(append(headerBytes, encData...))
_, err = cc.conn.Write(append(headerBytes, encData...))
if err != nil {
return err
}
cc.sentPackets++
cc.prevSendPacketCombinedCheck = combinedCheck

View File

@@ -286,7 +286,7 @@ func TestClientContextNilSafe(t *testing.T) {
func TestMsgSysPingBuildFormat(t *testing.T) {
pkt := &MsgSysPing{AckHandle: 0x12345678}
bf := byteframe.NewByteFrame()
pkt.Build(bf, &clientctx.ClientContext{})
_ = pkt.Build(bf, &clientctx.ClientContext{})
data := bf.Data()
if len(data) != 4 {
@@ -305,7 +305,7 @@ func TestMsgSysTimeBuildFormat(t *testing.T) {
Timestamp: 0xDEADBEEF,
}
bf := byteframe.NewByteFrame()
pkt.Build(bf, &clientctx.ClientContext{})
_ = pkt.Build(bf, &clientctx.ClientContext{})
data := bf.Data()
if len(data) != 5 {

View File

@@ -296,11 +296,11 @@ func TestBuildCoverage_Implemented(t *testing.T) {
// so we test it with defer/recover
t.Run("MsgSysLogout_Build", func(t *testing.T) {
defer func() {
recover() // may panic due to bug
_ = recover() // may panic due to bug
}()
pkt := &MsgSysLogout{Unk0: 1}
bf := byteframe.NewByteFrame()
pkt.Build(bf, ctx)
_ = pkt.Build(bf, ctx)
})
}

View File

@@ -258,7 +258,7 @@ func TestMsgSysAckBuildFormat(t *testing.T) {
ctx := &clientctx.ClientContext{}
bf := byteframe.NewByteFrame()
pkt.Build(bf, ctx)
_ = pkt.Build(bf, ctx)
data := bf.Data()