diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a1b0724..b0f3e84 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -26,6 +26,9 @@ jobs: - name: Lint the core module run: golangci-lint run ./... + - name: Check that the modules require a released core + run: scripts/check-modules.sh + - name: Lint the modules run: | . scripts/modules.sh diff --git a/integrations/goi18n/go.mod b/integrations/goi18n/go.mod index 584a134..6232b6a 100644 --- a/integrations/goi18n/go.mod +++ b/integrations/goi18n/go.mod @@ -5,7 +5,7 @@ go 1.27 replace github.com/insei/valigo => ../../ require ( - github.com/insei/valigo v0.0.0-00010101000000-000000000000 + github.com/insei/valigo v0.2.0 github.com/nicksnyder/go-i18n/v2 v2.6.1 github.com/stretchr/testify v1.12.1 golang.org/x/text v0.43.0 diff --git a/scripts/check-modules.sh b/scripts/check-modules.sh new file mode 100755 index 0000000..84e06be --- /dev/null +++ b/scripts/check-modules.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Checks that the modules of modules.sh require a released version of the core: the replace of their go.mod +# is ignored by the users, a pseudo-version of the core, v0.0.0-..., can't be downloaded. +set -euo pipefail + +root=$(cd "$(dirname "$0")/.." && pwd) +. "$root/scripts/modules.sh" +failed=0 +for module in $MODULES; do + version=$(cd "$root/$module" && go list -m -f '{{.Version}}' github.com/insei/valigo) + if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "$module requires github.com/insei/valigo $version, a released version expected" >&2 + failed=1 + fi +done +exit $failed