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
+3 -3
View File
@@ -20,7 +20,7 @@ func TestNewLogger_OutputModes(t *testing.T) {
t.Run("empty logFile uses io.Discard", func(t *testing.T) {
l, err := NewLogger("test-forward", "", 1024)
require.NoError(t, err)
defer l.Close()
defer func() { _ = l.Close() }()
assert.Nil(t, l.file)
assert.Equal(t, io.Discard, l.output)
@@ -34,7 +34,7 @@ func TestNewLogger_OutputModes(t *testing.T) {
l, err := NewLogger("test-forward", logFile, 2048)
require.NoError(t, err)
defer l.Close()
defer func() { _ = l.Close() }()
assert.NotNil(t, l.file)
assert.NotEqual(t, io.Discard, l.output)
@@ -58,7 +58,7 @@ func TestNewLogger_OutputModes(t *testing.T) {
err = l.Log(Entry{Direction: "request"})
require.NoError(t, err)
l.Close()
_ = l.Close()
// File should have both contents
data, _ := os.ReadFile(logFile)
+2 -2
View File
@@ -160,7 +160,7 @@ func TestNewLogger(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, l)
assert.Nil(t, l.file) // No file when using stdout
l.Close()
_ = l.Close()
// Test file logger (using temp file)
tmpFile := t.TempDir() + "/test.log"
@@ -173,7 +173,7 @@ func TestNewLogger(t *testing.T) {
err = l.Log(Entry{Direction: "request", Method: "GET"})
require.NoError(t, err)
l.Close()
_ = l.Close()
// Verify file has content
data, err := os.ReadFile(tmpFile)