Repository navigation
feat(plugins): add built-in Go Language plugin and calibrated Reference ranges - #431
Merged
Merged
Conversation
Calibrate Go Reference ranges from 20 pre-2023 public Go repositories following ADR 0008 and record the panel, exclusions, timing, peak RSS, Flagged line hand check, and 10th-to-90th percentile ranges in ADR 0021. Fix two defects uncovered during calibration with synthetic regression tests and re-measure all 20 panel repositories: - Keep else-after-return silent when an earlier if branch in an if/else if/else chain does not return. - Exclude the importing file from resolved Go package targets so build-constrained generator files in a package folder do not create spurious single-file import cycles. Publish the calibrated Reference ranges in the Go Language plugin, enable the Seam 2 conformance check for Go Erosion Reference ranges, and verify Go Reference ranges in codeint check output. Closes #425 Closes #426 Closes #427 Closes #428 Closes #429
…eat/228-go-language
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
Adds the built-in Go Language plugin (
codeint-lang-go,plugins/languages/go/, plugin namego) supporting Go 1.27 source files (.go), module and workspace discovery (go.mod,go.work), multi-file package import resolution, five idiomatic Go Flagged line rules, public non-internalentry-point reporting,program_startmarking onpackage mainfiles, calibrated Go Reference ranges across 20 pre-2023 public Go repositories (proposed ADR 0021), and full user documentation.Closes #228
Closes #394
Closes #395
Closes #396
Closes #397
Closes #398
Closes #399
Closes #400
Closes #401
Closes #402
Closes #403
Closes #404
Closes #405
Closes #406
Closes #407
Closes #408
Closes #409
Closes #410
Closes #411
Closes #412
Closes #413
Closes #414
Closes #415
Closes #416
Closes #417
Closes #418
Closes #419
Closes #420
Closes #421
Closes #422
Closes #423
Closes #424
Closes #425
Closes #426
Closes #427
Closes #428
Closes #429
Tier
Tier 3 from the tier check (
cargo run --locked -p xtask -- risk-tier --base origin/main): touches.rules(tier map rule".rules"),crates/plugin-host/Cargo.tomlandcrates/plugin-host/tests/conformance.rs(tier map rule"crates/plugin-host/**", registering Go Seam 2 conformance), andcrates/cli/tests/check.rs(updating the expected built-in language list to includegoand adding a Reference range test). Addsdocs/adr/0021-go-reference-ranges.md(status: proposed, awaiting Owner acceptance).Task
Spec #228 (
Spec: Go Language plugin) and sub-issues #394 through #429:plugins/languages/go/, Go Language plugin shell with the lexer #394-Each folder with ago.modfile is a Workspace package #412): zero external parser dependencies built oncodeint_model::scan, full Go 1.27 lexer with semicolon insertion, functions/methods/type parameters/function literals, decision points and Cognitive complexity, Source sets (*_test.go,testdata/,vendor/,// Code generated ... DO NOT EDIT.), five Flagged line rules (empty-branch,else-after-return,unused-return-blank,empty-defer,bare-recover), import collection and multi-file package resolution (including stdlib,"C",go.modmodule/require/// indirect/tool/replace,go.work),program_startonpackage main, public non-internalentry points, Seam 2 conformance, and CLI registration.// indirectlines ofgo.modare optional dependencies #422, ThegoLanguage plugin publishes its Reference range #429): 9 process-boundary integration tests incrates/cli/tests/integration/go.rs,docs/guide/go.md, updates todocs/guide/languages.md,docs/guide/README.md,docs/guide/configuration.md,docs/reference.md,docs/plugins.md,README.md,llms.txt,GLOSSARY.md, and.rules.toollines ofgo.modare development dependencies #423-Go Reference range ADR #428): measured 20 pre-2023 public Go repositories per ADR 0008 (12,052 Go files, 1,189,802 Go Production lines, 0 unparsable Go files;go-gitea/giteain 0.51s / 242.0 MiB RSS), hand-checked 113 Flagged lines across all 5 rules with 0 false positives, published calibrated Reference ranges inplugins/languages/go/src/lib.rsanddocs/adr/0021-go-reference-ranges.md.Fail-first test
plugins/languages/go/tests/conformance.rs(7 conformance suites),plugins/languages/go/tests/entry_points.rs(2 suites),crates/plugin-host/tests/conformance.rs(built_in_go_plugin_passes_seam_2_conformance),crates/cli/tests/integration/go.rs(9 process-boundary integration tests), andcrates/cli/tests/check.rs(go_check_displays_calibrated_reference_ranges_next_to_go_values).go.modescaped multi-byte UTF-8 panic, parenthesized method receiverfunc (w (*Widget)) M(), local+versionedreplacemismatch between resolution and dependencies, and composite function types with nestedfuncreturn types, pointer prefixes, and chained brackets like[2][3]*func() func() int{...}).Checks
cargo fmt --all --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --locked -p codeint-lang-gocargo test --locked -p codeint-plugin-hostcargo test --locked -p codeint-cli --test integration -- go::cargo test --locked -p codeint-cli --test referencecargo run --locked -p codeint-cli -- diff origin/main --format tooncargo run --locked -p xtask -- merged-resultSafety proof
go.mod/go.workmanifests without panics, unbounded loops, or I/O side effects.bfe403aproved Safety Fact 1 (all 9 Seam 2 conformance suites and 33 plugin-host load tests pass; existing TypeScript/JavaScript/Vue/Svelte, Rust, PHP, Dart, and Python behavior unchanged) and Safety Fact 2 (Go plugin has zero external parser crates, uses checked arithmetic and bounded scans, performs no filesystem/network/env I/O, and surfaces malformedgo.modas exit code 2).interrogate:bfe403a): 4 Go plugin edge cases (go.modescaped multi-byte UTF-8 panic,[]func(...){...}cognitive complexity inflation, local+versionedreplacedisagreement, parenthesized method receivers) and missing Go ranges/rules indocs/reference.md. All 5 fixed in11c5976with regression tests.11c5976): verified 4/5 fixes and found 1 residual case ([]func() func() int{...},map[K]func() func() int{...},[]*func() int{...}). Fixed in8b2b8ce.8b2b8ce): verified single-bracket composite function types and arithmetic expressions, and found 1 residual case (chained bracket prefixes before*funcsuch as[2][3]*func() func() int{...}and multi-row rule drops in[2][1]*func() int{ {row1}, {row2} }). Fixed in407ad00.407ad00): PASS (0 open verified findings across chained composite function types, index-multiplication expressions, multi-row flagged-line rules, loop termination, and all targeted Go and plugin-host conformance suites).Runtime evidence
407ad00internalentry points,program_startonpackage main, and calibrated Reference ranges.docs/adr/0021-go-reference-ranges.md): 12,052 Go files, 1,189,802 Go Production lines, 0 unparsable Go files; largest repository (go-gitea/gitea) checked in 0.51s with 242.0 MiB peak RSS.0.379..0.692, Duplication0.044..0.181, Verbosity0.045..0.183, Import cycles0.000..0.000, source"codeint panel of 20 Go repositories, ADR 0021, codeint 0.6.0".else-after-returnchain handling and self-import cycle filtering inethereum/go-ethereum).Gaps