From cc6b24e7904067b7e57757ad6ca8dbfd58b7efce Mon Sep 17 00:00:00 2001 From: Yan Yi Goh Date: Mon, 27 Apr 2026 14:39:55 +0800 Subject: [PATCH] auto_version: skip non-publishable go.mod modules The script tagged every directory containing a go.mod, which incorrectly published linter testdata fixtures (e.g. linters/isolint/testdata/v0.1.1) as releasable modules. Those fixtures are required to be standalone modules by analysistest, but they declare placeholder paths like "module example" and are not meant for consumption. Now each go.mod's declared module path must equal github.com/wego/pkg/; mismatches are skipped with a reason. This is the truthful semantic test for "is this a publishable wego/pkg module?", and it scales to any future auxiliary go.mod (more linter fixtures, examples, benchmarks) without needing path filters or marker files. Co-Authored-By: Claude Opus 4.7 (1M context) --- auto_version | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/auto_version b/auto_version index f1b9b4b..ddbf19f 100755 --- a/auto_version +++ b/auto_version @@ -45,8 +45,21 @@ for remote in $(git remote); do git pull "$remote" "$current_branch" done +module_root="github.com/wego/pkg" + for dir in $(find . -name 'go.mod' -exec dirname {} \; | sort -u); do pkg=$(echo "$dir" | sed 's/\.\///') + + # Only tag modules whose go.mod declares the canonical repo path. + # Auxiliary go.mod files (e.g. linter testdata fixtures, example modules) + # use unrelated module paths and must not be released. + declared_module=$(awk '/^module[[:space:]]/ { print $2; exit }' "$dir/go.mod") + expected_module="$module_root/$pkg" + if [[ "$declared_module" != "$expected_module" ]]; then + echo "skipping $pkg (module path \"$declared_module\" is not \"$expected_module\")" + continue + fi + latest_version=$(git tag --sort=-v:refname -l "$pkg/v*" | head -1 | sed 's/.*\///') current_version=$latest_version