Remove -strict flag, add //nolint:spantool and blank param support#4
Merged
Conversation
…suppression - Remove -strict flag and make undetectable callback detection always-on - Add //nolint:spantool comment directive to suppress individual diagnostics - Skip callbacks with _ parameter (intentionally unused row) - Include nolint hint in error message to guide users Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-strictフラグを廃止し、検出不可時のエラー報告をデフォルト動作に変更//nolint:spantoolコメントディレクティブで個別の診断を抑制可能にfunc(_ *spanner.Row) errorコールバック(row を意図的に使わない)をチェック対象外にflagパッケージのインポートを削除設計の背景
-strictフラグはオプトインのため、利用者が有効化しない限り検出不可ケースが見逃されていた。一方でデフォルト strict にすると、外部パッケージに row を渡すなど正しいコードでも誤検知が発生し、抑制手段がなかった。golangci-lint と同じ
//nolint:spantoolディレクティブ方式を採用することで、デフォルトで厳密なチェックを行いつつ、個別に抑制できるようにした。_パラメータのコールバック(SELECT 1による存在チェック等)は、そもそも row を使わないため検出不可エラーを出す意味がない。コールバック認識の段階でスキップすることで自然に除外される。検討した代替案
//spantool:ignoreのようなカスタムプレフィックス: golangci-lint との一貫性を優先しnolint:spantoolを採用Test plan
TestScan_Undetectable: 検出不可時に常にエラーが出ること、メッセージに nolint ヒントが含まれることTestScan_UndetectableNolint://nolint:spantoolで診断が抑制されることTestScan_BlankParamCallback:_パラメータでスキップされることTestScan_Detectable: 検出可能な場合はエラーなしgo test ./... -count=1)🤖 Generated with Claude Code