swag
swag copied to clipboard
cannot find all dependencies, <nil>
Describe the bug
swag init --parseDependency --parseInternal --parseDepth 5 --output docs/client -g cmd/client/main.go --exclude=internal/apps/crm,internal/apps/api
2022/06/16 14:15:28 Generate general API Info, search dir:./
2022/06/16 14:15:28 Generate swagger docs....
2022/06/16 14:15:28 warning: failed to get package name in dir: ./, error: execute go list command, exit status 1, stdout:, stderr:no Go files in /app
2022/06/16 14:15:40 pkg /app/cmd/client cannot find all dependencies,
To Reproduce swag init --parseDependency --parseInternal --parseDepth 5 --output docs/client -g cmd/client/main.go --exclude=internal/apps/crm,internal/apps/api
Expected behavior swagger docs
Your swag version 1.8.3
Your go version 1.18
Desktop (please complete the following information): Ubuntu 22.04
Additional context Downgrade to 1.8.2 solve the problem
I have no clue what the issue is. We need a way to reproduce the error in order to fix it.
@ubogdan @pytimer I also have same issue with @rowdyroad
we need to update README.md since there's no description for this option
First of all we need to describe exact error, now it's hard to see what's error
pkg .... cannot find all dependencies, <nil>
https://github.com/swaggo/swag/blob/97ea98ec1bd528b87a0fd6f5e3493a052dc762c0/parser.go#L297-L300return fmt.Errorf("pkg %s cannot find all dependencies, %s", pkgName, err)
should be
return fmt.Errorf("pkg %s cannot find all dependencies, %s", pkgName, err.Error())
For me I'm using echo and for the -g
option cmd/.../main.go
If I execute go list ./
it says no Go files in /Users/,,,/,,,/,,,
to generate go list
properly I need to execute go list ./...
.
and for in docker (WORKDIR /app), it says `no Go files in /app' as expected.
I didn't look into https://github.com/swaggo/swag/pull/1108 well, but.. seems direct call of go list
without some parameter may cause this problem
https://github.com/swaggo/swag/blob/0e2ec6ccb687ad91e20d33f4e433c460ca41acaa/golist.go#L13-L16
You can try setting swag init --parseGoList=false
.
Can you support some code to reproduce the error?
Error is an interface. It consists of two pointers: type pointer and data pointer
It's equal to nil if only both pointers is nil
fmt.Errorf returns <nil>
so data pointer is nil
err != nil -> type pointer is not nil