feat: add swag tool
This commit is contained in:
@@ -90,7 +90,7 @@ func (pkgDefs *PackagesDefinitions) getTypeFromGenericParam(genericParam string,
|
||||
TypeSpec: &ast.TypeSpec{
|
||||
Name: ast.NewIdent(string(IgnoreNameOverridePrefix) + "map_" + parts[0] + "_" + typeSpecDef.TypeName()),
|
||||
Type: &ast.MapType{
|
||||
Key: ast.NewIdent(parts[0]), //assume key is string or integer
|
||||
Key: ast.NewIdent(parts[0]), // assume key is string or integer
|
||||
Value: expr,
|
||||
},
|
||||
},
|
||||
@@ -123,7 +123,7 @@ func (pkgDefs *PackagesDefinitions) parametrizeGenericType(file *ast.File, origi
|
||||
return nil
|
||||
}
|
||||
|
||||
//generic[x,y any,z any] considered, TODO what if the type is not `any`, but a concrete one, such as `int32|int64` or an certain interface{}
|
||||
// generic[x,y any,z any] considered, TODO what if the type is not `any`, but a concrete one, such as `int32|int64` or an certain interface{}
|
||||
var formals []formalParamType
|
||||
for _, field := range original.TypeSpec.TypeParams.List {
|
||||
for _, ident := range field.Names {
|
||||
@@ -206,7 +206,7 @@ func (pkgDefs *PackagesDefinitions) parametrizeGenericType(file *ast.File, origi
|
||||
|
||||
// splitGenericsTypeName splits a generic struct name in his parts
|
||||
func splitGenericsTypeName(fullGenericForm string) (string, []string) {
|
||||
//remove all spaces character
|
||||
// remove all spaces character
|
||||
fullGenericForm = strings.Map(func(r rune) rune {
|
||||
if unicode.IsSpace(r) {
|
||||
return -1
|
||||
@@ -254,7 +254,7 @@ func (pkgDefs *PackagesDefinitions) getParametrizedType(genTypeSpec *genericType
|
||||
}
|
||||
}
|
||||
|
||||
//a primitive type name or a type name in current package
|
||||
// a primitive type name or a type name in current package
|
||||
return &ast.Ident{Name: genTypeSpec.Name}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user