You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using e.g. gopkg.in the import names do not match the package names. Go build works fine but swagger fails with error below.
Imported path: gopkg.in/guregu/null.v2
Package name : null
2015/09/10 20:56:27 Package null is not imported to bitbucket.org/aintuapps/api-go-poc/models, Imported: map[string][]string{"fmt":[]string{"fmt"}, "orm":[]string{"bitbucket.org/aintuapps/api-go-poc/orm"}, "errors":[]string{"errors"}, "driver":[]string{"github.com/SAP/go-hdb/driver"}, "sqlx":[]string{"github.com/jmoiron/sqlx"}, "null.v2":[]string{"gopkg.in/guregu/null.v2"}, "reflect":[]string{"reflect"}}
Swagger works when we replace the gopkg.in by the original github name github.com/guregu/null. That's not a good workaround because we lose ability to specify version of null.
The problem is in the parser.go function ParseImportStatements where the package name is generated from the import name like this:
@yvasiyarov sorry I don't know what exactly the proper solution is, I don't understand what exactly is ParseImportStatements trying to do. Why is it looping over all files then all imports and tries to get the package name from there when the package name is available right in package (the outermost loop).
I thought that the fix would be fairly simpe for somebody who understand the code but if not I'll look into some more and see if I can figure out a fix.
When using e.g. gopkg.in the import names do not match the package names. Go build works fine but swagger fails with error below.
Imported path: gopkg.in/guregu/null.v2
Package name : null
2015/09/10 20:56:27 Package null is not imported to bitbucket.org/aintuapps/api-go-poc/models, Imported: map[string][]string{"fmt":[]string{"fmt"}, "orm":[]string{"bitbucket.org/aintuapps/api-go-poc/orm"}, "errors":[]string{"errors"}, "driver":[]string{"github.com/SAP/go-hdb/driver"}, "sqlx":[]string{"github.com/jmoiron/sqlx"}, "null.v2":[]string{"gopkg.in/guregu/null.v2"}, "reflect":[]string{"reflect"}}
Swagger works when we replace the gopkg.in by the original github name github.com/guregu/null. That's not a good workaround because we lose ability to specify version of null.
The problem is in the parser.go function ParseImportStatements where the package name is generated from the import name like this:
The package name is actually astPackage.Name (we verified that it's set to string "null").
The text was updated successfully, but these errors were encountered: