Apply Go-specific judgment only when it is material. Establish the supported Go
versions, build configurations, platforms, compatibility policy, and task
authority before recommending a construct or response. Use the highest justified
Green — routine, Yellow — caution, Orange — warning, or
Red — crisis / stop level for one coherent current decision.
Keep packages and callables focused, preserve observable error and cancellation contracts, and make concurrency and resource ownership deterministic. Structural measurements warn about proposed growth; they do not select architecture or authorize retrospective rewrites.
Do not use this profile for:
unsafe, cgo, subprocesses, protected-data
flows, and performance independently of structure.implementing-with-test-discipline may remain primary for a behavior change;
reviewing-and-verifying-repository-work may remain primary for acceptance
review. This profile supplies Go judgment without silently invoking either.These defaults apply mainly to proposed growth in maintained hand-written Go. They are guidance signals, not linter claims or architecture decisions.
| Signal | Green — routine | Yellow — caution | Orange — warning | Red — crisis / stop |
|---|---|---|---|---|
| File physical lines | <= 400 |
401–700 |
701–1,000 |
>= 1,001 |
| Function or method statements | <= 20 |
21–35 |
36–50 |
>= 51 |
| Cyclomatic complexity | 1–5 |
6–10 |
11–20 |
>= 21 |
| Branch or decision count | <= 5 |
6–9 |
10–16 |
>= 17 |
| Maximum control nesting | <= 2 |
3 |
4–5 |
>= 6 |
| Parameters | <= 4 |
5–6 |
7–9 |
>= 10 |
| Local bindings | <= 10 |
11–15 |
16–20 |
>= 21 |
| Exported API breadth per package | <= 15 |
16–30 |
31–50 |
>= 51 |
| Independent concurrency ownership breadth | <= 2 |
3–4 |
5–7 |
>= 8 |
| Independent responsibility families | 1 |
2 |
3 |
>= 4 |
Count physical lines after universal-newline decoding; blanks, comments, raw
strings, and a final non-empty unterminated segment count. Parse with
go/parser. Count each non-ast.BlockStmt statement recursively owned by a
function or method and exclude nested function-literal bodies. Complexity starts
at one and adds if, for, range, non-default switch and type-switch cases,
select communication clauses, and short-circuit operands after the first.
Decisions count if and else if, loops, every switch, type-switch, and select
clause, and short-circuit decisions. Nesting is the maximum owned control depth; nested function
literals start new owners. Parameters count grouped names separately, unnamed
and variadic parameters once, and exclude receivers and type parameters.
For local bindings, use type information when possible and count unique
callable-owned non-blank variable objects introduced by local var
declarations, newly introduced names in short declarations, range declarations,
type-switch case-specific implicit variables, receive declarations using :=,
and named results. Count bindings in nested lexical blocks. Exclude parameters,
receivers, unnamed results, _, reassignments including receive =, constants,
types, labels, and bindings owned by nested function literals. Shadowed objects
count separately; reassignment does not. Record a separate closure-capture subtotal
for captures that mutate, escape, extend lifetime, or own a channel,
cancel function, synchronization primitive, resource, or mutable state. A
parser-only estimate is not a type-accurate count.
For exported API breadth, measure each project-supported configuration
separately, recording Go version, GOOS, GOARCH, cgo state, build tags, and
production or test-package variant. If that matrix is undefined, report the
measurement incomplete. Count each exported identifier in grouped const and
grouped var declarations; each exported defined type and type aliases once;
each exported function; each directly declared exported receiver/type/method
pair, including an exported method on an unexported receiver type; unexported methods do not count; each
explicit exported struct field name; each embedded exported field; and each
directly declared exported interface method. Generic declarations count like
their non-generic category; type parameters and instantiations do not add
entries. Count direct members even on unexported receiver or container types.
Exclude promoted fields and methods and interface members inherited only by
embedding from the numeric direct-declaration count, but review their
compatibility effects. Include generated declarations in the raw count and
report a generated subtotal. Exclude _test.go from the production package and
report test-augmented surfaces separately. Do not union mutually exclusive
variants or double-count duplicate declarations across build variants. Select
the maximum count across supported build configurations and record the
configuration that produced it. Label internal and main package surfaces
without calling them unrestricted module APIs. Record cgo or generated
contributions as unresolved when they cannot be established without
unauthorized execution.
Concurrency breadth counts independently changeable lifecycle, cancellation, shutdown, failure-propagation, communication-protocol, or synchronization ownership families within one function, type, or package owner. A homogeneous worker pool with one lifecycle and protocol is one family. Do not count raw goroutines, channel values, sends, or receives. Responsibilities are named independently changeable behavior or external-contract families, not stages of one cohesive result.
Follow the authorized owner or generator for generated, vendored, fixture, migration, snapshot, protocol, and machine-produced artifacts. Do not demand direct edits or hand refactoring because a derived artifact exceeds a threshold. Tests use the same measurements; a test filename is not an exemption.
An existing Red legacy artifact may receive the smallest safe fix when current authority permits it, the change adds no independent responsibility, and it avoids meaningful growth. Record the preserved boundary. New responsibility or major feature growth remains Red. A cohesive data-driven test may lower only a line-count response under accepted project policy; other structural and semantic signals remain effective.
errors.Is and
errors.As can be Green. A new public error promise is Yellow. Ignoring or
shadowing a material error is Orange and becomes Red when corruption,
security failure, data loss, or unsafe partial mutation is credible.defer in a loop is Orange and
becomes Red when exhaustion or unsafe partial mutation remains credible.
Copying a synchronization-bearing value is Orange and becomes Red when the
live copy can race, deadlock, or corrupt ownership.init or mutable global registration is Orange and becomes Red when
hidden state can race, corrupt, or escape lifecycle ownership.unsafe or cgo boundary is Orange only with reviewed memory,
lifetime, platform, validation, and rollback evidence; otherwise it is Red.Identify protected data under repository policy, including credentials, tokens, keys, private or personal payloads, private paths and topology, connection details, and classified identifiers. For each flow record source, transformation, sink, recipient or storage, authorization, minimization, and response. Inspect all of these sink families:
Parameterization and argument vectors can prevent injection without preventing disclosure. Redaction must precede every downstream formatting, wrapping, serialization, or fan-out boundary. Intentional disclosure to a bounded, authorized recipient is Orange and needs minimization, retention, validation, and rollback. Unauthorized, uncontrolled, overbroad, or unresolved disclosure is Red even when the sink is internal or private and regardless of structure.
This profile was inspected on 2026-07-21 against Go 1.26.5, the Go 1.26
specification, Go 1 compatibility policy, the memory model, modules reference,
and current standard-library documentation for parsing, types, errors, context,
synchronization, reflection, unsafe, cgo, subprocesses, testing, and
diagnostics. Go website prose is generally CC BY 4.0 except where noted, while
code displayed on the site is BSD licensed. The Go source distribution,
including source comments and source examples, uses the three-clause BSD terms.
Third-party modules rendered by pkg.go.dev retain their own licenses. APG uses
facts and independently written synthesis; copied or adapted expression would
require its applicable notice and attribution.
Versions are evidence, not mandated targets. Refresh before behavior-bearing correction, maturity review, or publication when supported releases, compatibility, memory semantics, parser/type behavior, tool defaults, or representative false-escalation evidence materially change. Removal must delete the leaf, projection, catalog and map entries, known-unmanaged handling, and focused tests while preserving ADR, evaluation, and exit history. No root or private source guidance was migrated, so rollback restores none of it.
The target repository owns supported Go versions, configurations and platforms; module, package, public API, compatibility, generated-code, build-tag, cgo, formatter, analyzer, race, fuzz, benchmark, test, coverage, dependency, supply-chain, deployment, concurrency, performance, artifact, exception, validation, rollback, mutation, release, and destructive-action policy.
When material, report the Go profile level, current and projected signals, supported configuration and measurement method, artifact classification, semantic and protected-data findings, project policy, required response, verification, exception if any, and rollback. Green needs project checks; Yellow adds version and tradeoff evidence; Orange adds an accepted local decision, adverse or compatibility evidence, and rollback; Red records the stopped action, safer alternative, and exact condition for reconsideration.
Stop or escalate when a goroutine can outlive authority; channel ownership can
panic, deadlock, or lose work; a credible race or unsafe synchronization copy
remains; material errors can hide corruption or partial mutation; protected data
can reach an unauthorized sink; untrusted input reaches shell interpretation;
unsafe or cgo lacks reviewed lifetime and platform evidence; a public break
lacks migration and rollback; destructive or live mutation lacks exact
authority; or meaningful new growth crosses Red without decomposition or an
accepted bounded exception.