You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R67 batch from the sa-165 census: three more fc5c4aa-stripped dead detectors (ignored_error_check.go, naked_return_check.go, empty_error_check.go) — all three entry functions verified zero-external-reference. Independent verification (sa-167, 11 probe tests, all run in-package) split them into two delete candidates and one register candidate.
ignored_error_check.go — delete + tombstone (revival = High risk)
Four empirically confirmed defects:
a1 — Factually-wrong assertion on 100% of common receiver names: the isKnownErrorMethod fallback (:363-374) fires on any standalone recv.Write(...) / recv.WriteString(...) when the receiver name is not one of six buffer names (buf/buffer/b/builder/sb/bld). sa-167 verified a zero-return-value method (func (fakeConn) Write(p []byte) {} — legal Go with no error return at all) called as conn.Write(data) still produces "These functions return an error that is not checked" — a factually wrong claim, one level deeper than the [business-logic] ignored_error_check false positives on bytes.Buffer and strings.Builder Write methods — always return nil error #111 always-nil case the file's own comment describes.
a3 — Dead three-segment keys + double-missed marquee scenario: in an untyped AST f.Close() resolves to Ident("f")+"Close" → "f.Close", never matching the "os.File.Close"-style keys. All os.File.*, http.ResponseWriter.*, http.Server.*, bufio.*, sql.*, os/exec.Command.* keys are unreachable. Worse, the file's own header example json.NewEncoder(w).Encode(data) resolves via constructorReturns to "json.Encoder.Encode" while the map key is "json.NewEncoder.Encode" (:78) — a double mismatch; detection rests entirely on the 30 generic method-name fallback.
a4 — Structurally unfixable without type info:x.Write(...) return type is unknowable in an untyped AST. Fixing requires go/types (architecture change to the write-integrity pipeline) or dropping the method fallback (which a3 shows carries ALL the detection). This is exactly why errcheck is built on types.Check.
b1: fires on the official defer+recover named-result idiom (24-line function, sa-167 verified) — warning text is a readability opinion ("hurt readability"), no factual error, but the fc5c4aa refactor explicitly removed advisory checks "to eliminate context pollution" (:79-80); threshold 20 vs revive nakedret default 30.
b2: does not recurse into FuncLit — verified correct/conservative (closures have their own named results), acceptable FN.
empty_error_check.go — REGISTER as "empty-error-body" (zero FP, positive value)
c1: pure-empty / comment-only / semicolon-only if err != nil { } bodies all detected with correct lines; non-error vars (if x != nil {}, if ok {}) exempt — zero FP across all probes.
c2: wider err-name matching (errCh/errno) fires but is benign in the empty-body scenario — any if x != nil {} with zero statements is suspect regardless of type.
Summary
R67 batch from the sa-165 census: three more fc5c4aa-stripped dead detectors (
ignored_error_check.go,naked_return_check.go,empty_error_check.go) — all three entry functions verified zero-external-reference. Independent verification (sa-167, 11 probe tests, all run in-package) split them into two delete candidates and one register candidate.ignored_error_check.go — delete + tombstone (revival = High risk)
Four empirically confirmed defects:
isKnownErrorMethodfallback (:363-374) fires on any standalonerecv.Write(...)/recv.WriteString(...)when the receiver name is not one of six buffer names (buf/buffer/b/builder/sb/bld). sa-167 verified a zero-return-value method (func (fakeConn) Write(p []byte) {}— legal Go with no error return at all) called asconn.Write(data)still produces "These functions return an error that is not checked" — a factually wrong claim, one level deeper than the [business-logic] ignored_error_check false positives on bytes.Buffer and strings.Builder Write methods — always return nil error #111 always-nil case the file's own comment describes._ = strconv.Atoi(s)(the standard Go syntax for deliberate discard) is flagged; errcheck by default does NOT flag blank identifiers (requires-blank). Same coaching-agents-into-breaking-correct-code class as [code-review] printf_format_check 双确定性误报:变参展开触发假 verb-count、转发包装函数触发假注入风险(go vet 对两者均豁免) #505.f.Close()resolves toIdent("f")+"Close"→"f.Close", never matching the"os.File.Close"-style keys. Allos.File.*,http.ResponseWriter.*,http.Server.*,bufio.*,sql.*,os/exec.Command.*keys are unreachable. Worse, the file's own header examplejson.NewEncoder(w).Encode(data)resolves viaconstructorReturnsto"json.Encoder.Encode"while the map key is"json.NewEncoder.Encode"(:78) — a double mismatch; detection rests entirely on the 30 generic method-name fallback.x.Write(...)return type is unknowable in an untyped AST. Fixing requires go/types (architecture change to the write-integrity pipeline) or dropping the method fallback (which a3 shows carries ALL the detection). This is exactly why errcheck is built on types.Check.naked_return_check.go — delete + tombstone (advisory class)
empty_error_check.go — REGISTER as "empty-error-body" (zero FP, positive value)
if err != nil { }bodies all detected with correct lines; non-error vars (if x != nil {},if ok {}) exempt — zero FP across all probes.if x != nil {}with zero statements is suspect regardless of type.Fix
{Name: "empty-error-body", Langs: []Language{LangGo}, Run: sliceCheck(checkEmptyErrorBody)}in allChecks.