Fix apipkg lookup in GenerateExample of testing plugin#256
Conversation
|
Nice, I like the direction here. Reading the package from generated metadata is a lot nicer than reconstructing it from the service name. One case I think we still need to handle: Could we either keep using the same API package derivation Goa uses for the top-level service implementation, or make this lookup target that specific top-level service file and handle the already-exists case explicitly? A small test for the existing-service-file/rerun case would be great too. |
|
Yes, I've modified it to derive apipkg in the same way as Goa core. |
|
Thank you! |
This pull request updates the logic in the
testing/generate.gofile to improve how the example implementation package name is determined when generating test suites. Instead of deriving the package name using string manipulation, the code now extracts it directly from the file header metadata, making the process more robust and accurate.Improvements to package name determination:
GenerateExampleto extract it from the file header'sPkgfield, rather than constructing it from the service name using string manipulation.Code cleanup:
stringspackage fromtesting/generate.go.