Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to specify an external module to include #1800

Open
ns-mglaske opened this issue Apr 24, 2024 · 1 comment
Open

Provide a way to specify an external module to include #1800

ns-mglaske opened this issue Apr 24, 2024 · 1 comment

Comments

@ns-mglaske
Copy link

Is your feature request related to a problem? Please describe.
I have a module that I include in my go app, that returns a struct that I'd like to use. This module, uses a model from a 3rd party to return it's results, and imports the 'model' module as 'em', and parseDependencies doesn't seem to pick it up, unless I pre-init the variable I use to contain the result. Basically, since I'm not using the struct directly, gofmt removes the reference from imports, since it's not used directly, so swag has no way to identify what em.Blah is.

Describe the solution you'd like
A way to specify a import that swag should use, but is not used by go directly. (eg. @includeDep em "github.com/blah")

Describe alternatives you've considered
I can get around this currently by pre-initializing the response variable.

import (
  em "github.com/blah"
)
func x() {
    resp := make([]em.Blah, 0)
    resp, err := library.GetDetails()
   ...

Maybe you already have a way around this, but I couldn't find it.

@haminh0307
Copy link

_ "github.com/blah"

Have you tried this? gofmt won't remove import statement with blank identifier as explicit package name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants