Skip to content

[Server] Fix --parseDependency error #14

@gwanryo

Description

@gwanryo

Error raised when generate swagger document with parsing dependency

swag init -d .\cmd\server\,.\ --parseDependency

Below is full log

PS C:\Users\USER\Desktop\Work\kiaranote\server> swag init -d .\cmd\server\,.\internal --parseInternal --parseDependency --generatedTime
2022/12/02 02:21:16 Generate swagger docs....
2022/12/02 02:21:16 Generate general API Info, search dir:.\cmd\server\
2022/12/02 02:21:16 Generate general API Info, search dir:.\internal
2022/12/02 02:21:16 warning: failed to get package name in dir: .\internal, error: execute go list command, exit status 1, stdout:, stderr:no Go files in C:\Users\USER\Desktop\Work\kiaranote\server\internal
panic: runtime error: negative shift amount

goroutine 1 [running]:
github.com/swaggo/swag.(*PackageDefinitions).evaluateConstValue(0xc0014e5ea0, 0xc003a93080?, 0xc003c91590?, {0x15d7498?, 0xc0014a5d40?}, {0x15d5ae0, 0xc0000a5dc0}, 0x15?)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/package.go:146 +0x101c
github.com/swaggo/swag.(*PackagesDefinitions).EvaluateConstValue(0xc009e1f698?, 0xc0014e5ea0, 0xc003c95680, 0x0)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/packages.go:282 +0x19d
github.com/swaggo/swag.(*PackagesDefinitions).evaluateAllConstVariables(...)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/packages.go:265
github.com/swaggo/swag.(*PackagesDefinitions).ParseTypes(0xc0000a5dc0)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/packages.go:110 +0x254
github.com/swaggo/swag.(*Parser).ParseAPIMultiSearchDir(0xc000196000, {0xc0000a5c20?, 0x2?, 0x0?}, {0x15088e4?, 0x7?}, 0x64)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/parser.go:375 +0x3bf
github.com/swaggo/swag/gen.(*Gen).Build(0xc000153a40, 0xc00014c2a0)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/gen/gen.go:182 +0x637
main.initAction(0xc00017af00?)
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/cmd/swag/main.go:158 +0x7bd
github.com/urfave/cli/v2.(*Command).Run(0xc000127560, 0xc00016c500)
        C:/Users/USER/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:163 +0x5bb
github.com/urfave/cli/v2.(*App).RunContext(0xc000150820, {0x15d8288?, 0xc0000aa0e8}, {0xc0000d8000, 0x7, 0x8})
        C:/Users/USER/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:313 +0xb48
github.com/urfave/cli/v2.(*App).Run(...)
        C:/Users/USER/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:224
main.main()
        C:/Users/USER/go/pkg/mod/github.com/swaggo/[email protected]/cmd/swag/main.go:229 +0x55d

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbackend taskbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions