From a134f8443af50b6478c6a64874a82625ecfe2de9 Mon Sep 17 00:00:00 2001 From: mrhid6 Date: Tue, 8 Sep 2026 07:47:00 +0000 Subject: [PATCH] fix: download vantage-shared before asking the module cache where it is go list -m -f '{{.Dir}}' reports an empty Dir and exits 0 for a module that is not in the cache, so on a cold runner swag was handed an empty --dir and failed several steps later with 'dir: does not exist'. Download first, and fail loudly if the path is still not there. --- .gitea/workflows/server-deploy.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitea/workflows/server-deploy.yml b/.gitea/workflows/server-deploy.yml index 01da71a..26be3c3 100644 --- a/.gitea/workflows/server-deploy.yml +++ b/.gitea/workflows/server-deploy.yml @@ -134,7 +134,17 @@ jobs: # shared module's files on disk. They are in the module cache # now rather than at ../shared, and the cache is read-only, # which swag does not mind. + # + # go mod download first: `go list -m -f {{.Dir}}` reports an + # empty Dir and exits 0 for a module that is not yet in the + # cache, so on a cold runner swag was handed an empty path and + # failed with "dir: does not exist" several steps later. + go mod download gitea.hostxtra.co.uk/vantage/vantage-shared SHARED_DIR="$(go list -m -f '{{.Dir}}' gitea.hostxtra.co.uk/vantage/vantage-shared)" + if [ -z "$SHARED_DIR" ] || [ ! -d "$SHARED_DIR" ]; then + echo "vantage-shared source not in the module cache: '$SHARED_DIR'" >&2 + exit 1 + fi swag init --generalInfo cmd/main.go --dir "./,$SHARED_DIR" \ --output internal/api/docs --outputTypes json --v3.1 mv -f internal/api/docs/swagger.json internal/api/docs/openapi.json