Skip to content

Commit d141821

Browse files
committed
chore: trim comments
1 parent c189d00 commit d141821

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

scripts/check-module-deps.sh

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@
22
#
33
# Checks the cross-module dependency graph against an explicit allowlist, and catches stale indirect requires.
44
#
5-
# check-acyclic-deps.sh enforces layering: a module may not import from a strictly higher tier. That is necessary but
6-
# not sufficient. aws and k8s are both tier 3, so k8s importing aws for a single EC2 call never violated the tier
7-
# rule, and it went unnoticed until a user reported that depending on k8s pulled in 23 AWS service SDKs (#1875).
5+
# check-acyclic-deps.sh enforces layering only. aws and k8s are both tier 3, so k8s importing aws for one EC2 call
6+
# never violated it (#1875). This requires every edge to be listed on purpose instead.
87
#
9-
# This script enforces the complementary rule: every cross-module edge is listed below on purpose. Adding one is a
10-
# deliberate act with a reviewer attached, not something that happens because an import was convenient.
8+
# It also catches staleness: nothing tidies submodule go.mod files, so when k8s dropped aws, helm kept it as an
9+
# indirect and shipped 72 aws-sdk-go-v2 go.sum entries for code no module imported.
1110
#
12-
# It also catches the second half of that problem. When k8s stopped requiring aws, helm kept carrying aws as an
13-
# indirect require, because nothing tidies submodule go.mod files: the go-mod-tidy-check workflow runs at the repo
14-
# root and diffs only the root go.mod and go.sum. helm shipped 72 aws-sdk-go-v2 entries in its go.sum for code no
15-
# module imported. An indirect require that is not reachable through the declared direct graph is stale.
16-
#
17-
# No -e: accumulate every violation and report them all, rather than aborting on the first.
11+
# No -e: accumulate every violation rather than aborting on the first.
1812
set -uo pipefail
1913

20-
# Permitted direct cross-module requires, as "importer:importee".
21-
#
22-
# Test-only edges still appear here, because a test dependency is a real entry in go.mod. Keeping the graph small is
23-
# the point of the v2 split, so treat an addition as a design decision: prefer injecting behaviour over taking the
24-
# dependency. modules/k8s/kubectl_options.go NodePublicIPLookup is the worked example.
14+
# Permitted direct cross-module requires, as "importer:importee". Test-only edges count, since a test dependency is
15+
# a real go.mod entry. Treat an addition as a design decision: prefer injecting behaviour over taking the dependency
16+
# (see NodePublicIPLookup in modules/k8s/kubectl_options.go).
2517
ALLOWED_EDGES=(
2618
"aws:core"
2719
"aws:ssh" # Ec2Keypair embeds ssh.KeyPair; SCP helpers
@@ -119,9 +111,8 @@ for allowed in "${ALLOWED_EDGES[@]}"; do
119111
fi
120112
done
121113

122-
# 3. Every indirect terratest require must be reachable through the declared direct graph. An unreachable one is a
123-
# stale entry left behind when some other module dropped the dependency, and it drags that module's whole
124-
# transitive tree into every consumer's go.sum.
114+
# 3. Every indirect terratest require must be reachable through the declared direct graph. An unreachable one is
115+
# stale, and drags a whole transitive tree into every consumer's go.sum.
125116
reachable_from() {
126117
local start="$1"
127118
local -A visited=()

0 commit comments

Comments
 (0)