Skip to content

Code Analysis Go SDK Types

Tu Shaokun edited this page Nov 7, 2026 · 2 revisions

Go source calls with SDK type exports

Draft #1266, head f8470917f7f80e279555025bee25af81f544c8f1, extends #1265 in native stack #1262. Original team, Python, Go/Rust and later language commits/authorship/PR ownership remain. Not in Labs, approved, merged, released or installed. Labs remains bf0a29e7664f52973d06a8e6a608df2db1ecbd39.

One more step in a real investigation

In Chi71307f9b7e4e9527638bc951c42b782cd1560331, mux.go:82 rctx.Reset() previously stopped at an unknown receiver. Now the explicit *Context assertions at71/81, supported by real net/http/context/sync SDK types, reach context.go:82. NotFound at309→203 and MethodNotAllowed at312→223 similarly follow explicit *Mux assertions. http.Handler.ServeHTTP at73/90 stays unknown interface dispatch. No variable-flow guessing or method-name search was added.

The normal CLI uses official go/types and the SDK gc importer. Root project sources remain the immutable capture. SDK package preparation runs only for known standard-package paths in an empty directory, with modules/workspaces/cgo disabled and module proxy/checksum access off. No project source, test, build or generator command is invoked. SDK source files are not analyzed or added as navigation targets.

Pinned evidence and limits

Fixed project SDK targets added Previous targets changed Full-graph compiler-known captured method-body matches
Chi 3 0 459/459 (parent456/459)
gRPC 34 0 8070/8070 (parent8036/8070)
Cobra 0 0 789/789 both sides

All37 newly found targets agree with the separately configured full go/packages compiler graph, with zero different/unavailable targets and no full-graph diagnostics. Across the fixed known-body cohort the candidate matches9318/9318, zero wrong or missed in that cohort. All64930 call ranges,15174 functions, import inventories and existing targets remain. Remaining product typing errors are0 Chi,10918 gRPC and230 Cobra; incomplete third-party types remain visible.

These are exposed repositories, not blind samples or whole-project precision/recall. gRPC/Cobra were reserved from first Chi prototype tuning. Prototype, earlier compiler and current accepted observations overlap; do not add their counts as independent evidence. The existing Chi Match change retains2base/4head verified callers and partial/exit1. Reset's body is unchanged in that pair, so this follow-up does not claim a changed-Reset experiment.

Fixed revisions/hashes, source-first answers, oracle correction, replay commands, per-target compiler rows and scope. The pins inherit the original Cobra/Chi/gRPC studies and are verified before replay.

Language contract and configuration

go-source-direct-v3, adapter revision3, enables required SDK type exports by default. go.stdlib:false explicitly disables preparation, preserving partial captured-only typing and keeping the three Chi targets unknown. Questions identify the disabled scope distinctly. Historical v1 free-function and v2 concrete-method captures retain their coverage contracts; an actual v2 saved question is readable in source/ZIP.

languageScope.standardLibrary reports SDK version, requested roots, prepared dependency count, actual archive bytes/SHA256 and intrinsic unsafe use. SDK source is explicitly not analyzed. Normal output also records selected/excluded source files, parse failures, declared GOOS/GOARCH/tags, tests and cgo=false. Architecture sizing uses the declared target. Source release/tool tags come from the running SDK; target CPU-feature/experimental overrides are not independently reconstructed.

Third-party dependencies, go.work/replace/vendor/nested-module assembly, generated/cgo output and complete builds remain unsupported. go.mod language/toolchain directives are captured but not enforced by this partial checker. Interface/function-variable dispatch, argument applicability, runtime execution/nil safety and complete caller sets remain unproved. Missing Go or invalid SDK setup exits2 with installation/target guidance and the explicit disabled option.

Reproduce and inspect distribution

python3 benchmarks/code-analysis-go-stdlib-types/run.py \
  --cli archify/bin/archify.mjs --samples-root /fixed/samples --out /runs/source

For the parent, use #1265's CLI plus --expect baseline. For ZIP, use the extracted entrypoint. Both distributions find37correct/0wrong/0missed targets and retain2interface unknowns. Checks deliberately use --fail-on never, not a claim of no findings. Candidate SDK-disabled scope stays explicit. The pair remains partial/exit1; checks and saved questions exit0.

Four raw captures (three projects plus disabled Chi) are byte-identical. Six questions agree after only installation/output path normalization; actual historical v2 parity also passes. Two canonical Node22.23.3 / zlib1.3.1-e00f703 builds match all168 module files. ZIP SHA2569958f4006d83551c47eab16608177c8c916890ef1f4d4923d2d9ffa6c74dc23e.

Setup cost and separate states

Go product floor remains1.18+, using SDK libraries only; these runs use existing Go1.27.2 Darwin/arm64. No new product dependency or toolchain installed. The optional full-graph audit alone reuses pinned x/tools0.52/Go1.26+, outside the ZIP.

Chi needs213 prepared SDK dependencies and reads33 exports totaling57067902bytes, rather than the prototype's full372archives/214MB. Normal CLI with an initially empty local GOCACHE took6.90s and left154952KiB, including helper compilation and needed exports. SDK installation was already complete, external cache programs were absent, and warm/cold facts agree. This is a recorded local cost, not a general speedup or fresh SDK installation benchmark.

  • Local: runtime61b28dc07: module383/383, focused Go12/12, core19/19, release identity pass; zero skips where applicable. 32/64-bit and invalid/disabled SDK scope tests protect profile boundaries.
  • Package: Go/question/change40/40, zero skips; source/ZIP, SDK-disabled questions and historical-v2 parity pass.
  • Remote: final-head CI42415994037 completed success atf8470917f7f80e279555025bee25af81f544c8f1. The actual module log reports 383/383 passed, zero skips. Both complete regression/browser shards, maintained Node lanes, ZIP/WebM, all three platform packages and both Windows lanes passed; deployments skipped. Optional full-graph attribution is a separate local audit.
  • Integration: Draft only. No approval, formal merge, release or live installation.

Next: source-backed third-party/build gaps and investigation interruptions, Rust generic/trait boundaries, and the JS/TS/Python/Java backlog. Resolving these37 recorded Go misses does not complete the persistent six-language objective.

Clone this wiki locally