Skip to content

[code-review] ignored_error + naked_return dead detectors: delete+tombstone (sa-167-verified FP classes); empty_error_check: register as zero-FP Pattern-1 per #507 tombstone reservation #508

Description

@topcheer

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:

  • 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.
  • a2 — Blank-assign conflict with ecosystem: _ = 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.
  • 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.

naked_return_check.go — delete + tombstone (advisory class)

empty_error_check.go — REGISTER as "empty-error-body" (zero FP, positive value)

Fix

  1. Delete ignored_error_check.go + _test.go, naked_return_check.go + _test.go (all 26 symbols verified zero-external-reference).
  2. Register {Name: "empty-error-body", Langs: []Language{LangGo}, Run: sliceCheck(checkEmptyErrorBody)} in allChecks.
  3. Extend the write_integrity.go tombstone block with [code-review] ignored_error + naked_return dead detectors: delete+tombstone (sa-167-verified FP classes); empty_error_check: register as zero-FP Pattern-1 per #507 tombstone reservation #508: ignored-error revival requires go/types; naked-return revival requires min-lines>=30 + instance-level delta + closure coverage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions