swag: Swag init no longer works after updating to 1.5.1
Describe the bug Previously used Swaggo/Swag 1.5.0. No longer works after updating to 1.5.1. Getting the following output:
2019/07/01 10:31:18 Generate swagger docs....
2019/07/01 10:31:18 Generate general API Info
2019/07/01 10:31:18 execute go list command, exit status 1
To Reproduce Not entirely sure. Using a standard layout with cmd, pkg and internal folders. Running swag init from project root folder.
Steps to reproduce the behavior:
- Use swag 1.5.1
- Run swag init.
Expected behavior Swag generates swagger docs in docs-folder.
Your swag version 1.5.1
Your go version 1.12.6
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 25 (12 by maintainers)
I am having the same issue, can we reopen this or get pointed to the correct solution?
we have almost the same project structure as @lsattem Today I updated swag to v1.6.0, and it works fine as
without any changes in the project structure I had some errors on v1.5.1 yesterday, but today I cannot reproduce them
I’m having this exact same issue on swag v1.6.7. What was the best recommended fix? Tried everything in this thread and it doesn’t work. Following project structure as recommended here:
https://github.com/golang-standards/project-layout
cmd/app/main.go <- the application entrypoint and where initial swagger attributes are above main() pkg/api/server.go <- where the HTTP API starts up with Echo pkg/api/[entity]/[entity].go <- multiple folders that follow this path. Each entity contains a set of API docs for their respective API routes.
I’m sorry to keep you waiting. This is the reproduced repo. I run
swag init -g app/main/mian.goand get below message@easonlin404 I used v1.6.0 when writing the previous message. Adding --parseDependency=true does not make any difference. This is not an outside dependency, as I understand it. The swagger doc is in a file in this specific project, and Swag no longer seems able to detect any go files in my project.
Running the following:
Yields this output:
Relevant project structure
I tried playing around with the “-d” and “-g”, parameters (e.g. full path), but to no avail. It still is unable to detect any go files.
@lsattem The issue have fixes after merged https://github.com/swaggo/swag/pull/425. And now you update version to v1.6.0 and execute the following to specify paring outside dependencies, disabled by default.
swag init --parseDependency=true