Documentation
¶
Overview ¶
Script: aws-models Fetches the AWS Smithy models pinned by models/aws/VERSION into a per-user cache and prints the directory `awsmodelgen -models` accepts.
Usage:
go run ./scripts/aws-models.go --ensure # full checkout go run ./scripts/aws-models.go --ensure --service acm # one service go run ./scripts/aws-models.go --ensure --service acm,s3 # several go run ./scripts/aws-models.go --prune # drop other revisions go run ./scripts/aws-models.go --prune --dry-run # say what --prune would drop
It composes, which is the whole point — the directory is the only thing on stdout, every progress line and git's own output goes to stderr:
make aws-models-check AWS_MODELS_DIR="$(go run ./scripts/aws-models.go --ensure)" make generate-aws-operations AWS_MODELS_DIR="$(go run ./scripts/aws-models.go --ensure)"
Why a cache outside the repository: this project's workflow puts every task in its own worktree, routinely ten or more at once, and the corpus is large. One copy per revision under the user cache directory is shared by all of them, stays out of `git status`, ripgrep and editor indexing, and survives deleting a worktree. os.UserCacheDir already encodes the per-platform location — %LOCALAPPDATA% on Windows, $XDG_CACHE_HOME (or ~/.cache) on Linux, ~/Library/Caches on macOS — so the layout is the same everywhere:
<user cache>/overcast/aws-models/<revision>/models
Why it never needs updating: it fetches the exact revision recorded in models/aws/VERSION, never "latest". Keeping that pin current is the AWS API model refresh workflow's job. A revision's cache is therefore immutable and cannot go stale — it is either present or fetched.
Completeness is a sentinel file written only after a fetch has fully succeeded, so a clone interrupted halfway is redone rather than trusted. The sentinel also records which services a sparse checkout holds, which is how a later --service for a service that is not there widens the same checkout instead of refetching it.
Unlike the other programs in this directory this file is NOT `//go:build ignore`: it is the one with unit tests beside it, and staying in the default build is what lets `go test ./scripts/...`, `go vet ./...` and golangci-lint see both files. It is still run the same way, and it is still not part of the compiled binary — nothing outside scripts/ imports it.