Documentation
¶
Overview ¶
Command structfielddiff dumps every field of every <Op>Input, <Op>Output and nested struct the pinned aws-sdk-go-v2 source declares for one or more services, so the fields can be diffed by hand against gopherstack's own wire model.
This generalizes the mechanical struct-field diff that found real bugs in s3 (c9b6c702a) and dynamodb (89eac08ea) beyond those two services. Unlike cmd/overwidecandidates and cmd/requiredoutputfields, which each look for one shape (over-wide List responses, required-but-unpopulated outputs), this tool dumps the FULL field set of every request/response shape so a human can compare it field-by-field against gopherstack's handler and catch the other bug classes: a field declared on gopherstack's domain model and never wired to the wire type, a member modeled with the wrong Go type, or a nested struct missing a field its parent has.
It resolves the pinned aws-sdk-go-v2/service/<mod> version from go.mod (dirModuleOverride maps the handful of services where the directory name and module name diverge, same table as the sibling tools), reads every api_op_<Op>.go and types/types.go file from $(go env GOMODCACHE)/github.com/aws/aws-sdk-go-v2/service/<mod>@<version>, and for each "type X struct {" walks blank-line-separated top-level field blocks (brace-depth tracked) to pull out field name, declared type and whether the doc comment marks it required. Fields are then expanded recursively through nested struct types (cycle-guarded, depth-limited) so the dump includes everything reachable from an Input or Output.
This only extracts the SDK side. It says nothing about whether gopherstack's handler populates or reads any of it -- that comparison, and the hand-verification against the real serializer that the noise rate demands, stays a human step.
Usage:
go run ./cmd/structfielddiff -service sts go run ./cmd/structfielddiff -service sts -op AssumeRole go run ./cmd/structfielddiff -service secretsmanager -json out.json