zjncs commented on PR #5618:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/5618#issuecomment-6076680044

   Hi @lizhimins, thanks for the detailed review. I've switched to the 
`.gitattributes` approach as suggested, rebased onto rocketmq-studio c99b9ad5 
and retargeted the PR. Point by point:
   
   **Switched to `.gitattributes`.** Added a root `.gitattributes` containing:
   
   ```
   *.go text eol=lf
   ```
   
   The committed Go catalog (`rmqctl/internal/catalog/catalog_gen.go`) is the 
only generated artifact git ever checks out — `docs/generated/` (the markdown 
and SDK JSON outputs) is in `.gitignore`, so no entries are needed for those. 
This pins the working-tree copy to LF even on a `core.autocrlf=true` checkout, 
which fixes the verify gate and the `make catalog-generate` rewrite in one 
place, and since `verify` stays a byte-exact `bytes.Equal`, a catalog that was 
actually committed with CRLF still fails `-check` — the freshness check is not 
weakened.
   
   **`verify` restored to byte-exact.** `generate/main.go` is back to the plain 
`bytes.Equal` comparison (plus a doc comment recording why the gate stays 
EOL-strict and pointing at the `.gitattributes` pin).
   
   **Trailing newlines restored** on `main.go` and `verify_test.go`; `gofmt -l 
.` is clean, so `make fmt` (ci.yml) passes.
   
   **Tests updated to the new semantics** in `verify_test.go`:
   - `TestCheckRejectsLineEndingDrift` — a CRLF copy of an otherwise current 
catalog must fail `-check` (the inverse of the old tolerance test; a 
CRLF-committed catalog can no longer pass undetected).
   - `TestCheckStillDetectsRealStaleness` — genuinely different content is 
still rejected.
   - `TestGitAttributesPinsGoFilesToLF` — guards the `*.go text eol=lf` pin and 
fails if the entry is dropped or changed. Since the rmqctl CI job runs on 
ubuntu-latest, a removed rule would otherwise never show up in CI.
   
   `go test ./...` is green. One note: existing Windows checkouts need a 
one-time refresh of the affected files after pulling this (e.g. `git checkout 
-- rmqctl/internal/catalog/catalog_gen.go`); fresh clones are unaffected.
   


-- 
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]

Reply via email to