b1ngsha opened a new pull request, #1186:
URL: https://github.com/apache/incubator-seata-go/pull/1186

   - [ ] I have registered the PR 
[changes](https://github.com/apache/incubator-seata-go/tree/master/changes).
   
   **What this PR does**:
   
   `resolverFilePath` split the basename on `.` and always used index 1 as the 
format suffix. `seatago.prod.yaml` was therefore treated as `prod`, and 
`client.LoadPath` / `client.InitPath` panicked with `no support prod file 
suffix`.
   
   This PR takes the last extension via `filepath.Base` / `filepath.Ext`, 
lower-cases it, and keeps the existing default of `yaml` when there is no 
format suffix.
   
   **Which issue(s) this PR fixes**:
   
   Fixes #1177
   
   **Special notes for your reviewer**:
   
   A leading-dot name with no extra dot (`.seatago`) is treated as having no 
extension. `filepath.Ext(".seatago")` returns `.seatago`, which is the 
hidden-file marker, not a format.
   
   Unsupported suffixes still panic through the existing `LoadPath` / 
`InitPath` API. Error-returning variants (`LoadPathE` / `InitPathE`) are left 
as follow-up.
   
   Table tests cover single/multiple dots, `yaml` / `yml` / `json` / `toml`, 
upper case, no extension, hidden files, and Windows-style paths (suffix only on 
the Windows strings, because `\` is not a separator on the Linux/macOS CI 
runners). `TestLoadPath_FilenameWithMultipleDots` is the issue repro: load a 
real config copied to `seatago.prod.yaml` and assert no panic.
   
   Existing `TestLoadPath` / `TestLoadJson` are unchanged.
   
   **Does this PR introduce a user-facing change?**:
   
   Yes. Config files whose basename contains extra dots (for example 
`seatago.prod.yaml`) can now be loaded.
   
   ```release-note
   Fix config format detection so filenames with extra dots (e.g. 
seatago.prod.yaml) are parsed from the last extension instead of panicking at 
startup.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to