mirror of
https://gitee.com/johng/gf
synced 2026-07-08 22:40:30 +08:00
## Summary - Fix `gf gen service` incorrectly handling versioned imports (e.g., `github.com/minio/minio-go/v7` → `github.com/minio/minio-go`) - The root cause was faulty package name inference from import paths - Go allows package names to differ from directory names - Solution: Keep all non-anonymous imports and let gofmt clean up unused ones ## Changes - Simplified `calculateImportedItems` function in `genservice_calculate.go` - Added test case for versioned imports and aliased imports ## Test plan - [x] All existing genservice tests pass (`Test_Gen_Service_Default`, `Test_Issue3328`, `Test_Issue3835`) - [x] New test `Test_Issue4242` verifies both versioned imports and aliased imports are preserved - [x] Verified generated files match expected output exactly Closes #4242 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>