Skip to content

fix: remove redundant io.Writer type annotation (staticcheck QF1011)#2780

Merged
lpcox merged 1 commit intomainfrom
fix/lint-staticcheck-qf1011
Mar 29, 2026
Merged

fix: remove redundant io.Writer type annotation (staticcheck QF1011)#2780
lpcox merged 1 commit intomainfrom
fix/lint-staticcheck-qf1011

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Mar 29, 2026

Summary

Fixes staticcheck QF1011 lint warning in internal/logger/file_logger_test.go.

GetWriter() already returns io.Writer, making var _ io.Writer = logger.GetWriter() redundant. Replaced with a simple call + require.NotNil assertion and removed the unused io import.

Verification

make agent-finished ✅ — all lint, build, and tests pass.

GetWriter() already returns io.Writer, making the explicit type
annotation redundant. Remove it and the unused io import.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 29, 2026 15:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes a redundant compile-time io.Writer assignment in the logger tests that was triggering staticcheck QF1011, and replaces it with a runtime non-nil assertion.

Changes:

  • Dropped the unused io import from internal/logger/file_logger_test.go.
  • Replaced var _ io.Writer = logger.GetWriter() with w := logger.GetWriter() plus a require.NotNil assertion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 242 to +256
t.Run("GetWriter implements io.Writer interface", func(t *testing.T) {
tmpDir := t.TempDir()
logDir := filepath.Join(tmpDir, "logs")

err := InitFileLogger(logDir, "writer-test.log")
require.NoError(t, err)
defer CloseGlobalLogger()

globalLoggerMu.RLock()
logger := globalFileLogger
globalLoggerMu.RUnlock()

require.NotNil(t, logger)
var _ io.Writer = logger.GetWriter()
w := logger.GetWriter()
require.NotNil(t, w)
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subtest name "GetWriter implements io.Writer interface" is no longer accurate/meaningful: after removing the compile-time interface assignment, it only asserts the returned writer is non-nil, which is already guaranteed by (and effectively covered in) the earlier subtests that assert *os.File / os.Stdout. Consider removing this subtest entirely or repurposing it to verify behavior that isn’t already covered (e.g., that the returned writer can be used for a write).

Copilot uses AI. Check for mistakes.
@lpcox lpcox merged commit 65d620c into main Mar 29, 2026
24 checks passed
@lpcox lpcox deleted the fix/lint-staticcheck-qf1011 branch March 29, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants