chore: add golangci-lint v2 config and fix linter warnings (#46)

- [x] Add golangci-lint v2 configuration with formatters section
- [x] Reorganize linters-settings under linters section
- [x] Replace if-else chains with switch statements for clarity
- [x] Wrap all ignored error returns with `_ = ` pattern
- [x] Add OSC 8 hyperlink helper function for clickable ports
- [x] Add blank line in table styling function
- [x] Remove unnecessary type assertion in test
This commit is contained in:
2026-02-13 18:46:27 +00:00
committed by GitHub
parent d3c5e5eb36
commit e50f73ec92
17 changed files with 65 additions and 47 deletions
+1 -1
View File
@@ -439,7 +439,7 @@ func (c *Checker) checkDataTransfer(port int) error {
if err != nil {
return err
}
defer conn.Close()
defer func() { _ = conn.Close() }()
// Set a short read deadline to detect hung connections
// We don't expect to receive data, but we want to verify the connection isn't hung
+5 -5
View File
@@ -46,7 +46,7 @@ func (s *HealthCheckTestSuite) TearDownTest() {
s.checker.Stop()
}
if s.listener != nil {
s.listener.Close()
_ = s.listener.Close()
}
}
@@ -198,17 +198,17 @@ func (s *HealthCheckTestSuite) TestDataTransferMethod() {
case "banner":
_, _ = conn.Write([]byte("220 Welcome\r\n"))
time.Sleep(50 * time.Millisecond)
conn.Close()
_ = conn.Close()
case "close":
conn.Close()
_ = conn.Close()
case "silent":
// Just keep connection open
time.Sleep(200 * time.Millisecond)
conn.Close()
_ = conn.Close()
}
}
}()
defer testListener.Close()
defer func() { _ = testListener.Close() }()
} else {
testPort = 54322 // Unused port
}