123123213weqw opened a new pull request, #5837: URL: https://github.com/apache/rocketmq-dashboard/pull/5837
## Why In single-file mode (`-input`), `run()` declared a new `source` variable inside the `else` branch, shadowing the outer one used later for the digest and the SDK contract. As a result: - `catalog_gen.go` always carried `Digest: e3b0c442...` (the SHA-256 of empty input), regardless of the file passed; - the `-sdk` JSON contract was rendered from a nil source and contained just `null`. Multi-file mode (`-input-dir`), which the Makefile uses, was unaffected, so the committed catalog stayed correct — but the documented single-file mode produced silently wrong artifacts. ## What changed - `run()` now assigns the file contents to the outer `source` variable instead of declaring a shadowed copy, so the digest and SDK contract derive from the document that was actually parsed. ## Validation - New red-first test `TestRunSingleFileModeDigestMatchesSource` asserts the generated `Digest` equals the SHA-256 of the input file and the SDK contract contains the tool name (previously failed with the empty-input digest and `null` contract). - `go build ./...`, `go vet`, `gofmt` clean; `go test ./internal/catalog/generate/...` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
