swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
MIT License
3.66k stars 266 forks source link

use go work report swaggerFiles could not import error #272

Open cyxr001 opened 1 year ago

cyxr001 commented 1 year ago

We have a monorepo, and some of module import github.com/swaggo/gin-swagger v1.2.0 the project layout like this:

- repo
     - project-b
         - xxx
     - project-a
         - package-a
         - package-b
         - go.mod
         - go.sum 
- go.work
- go.work.sum

package-a import import :

import "github.com/swaggo/gin-swagger/swaggerFiles"

package-a go mod:

require (
github.com/swaggo/gin-swagger v1.2.0
....
)

go work: use ./project-a

the vscode report : could not import github.com/swaggo/gin-swagger/swaggerFiles (no required module provides package "github.com/swaggo/gin-swagger/swaggerFiles")

once I remove the go.work and go.work.sum, it won't report this error