mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 08:41:29 +00:00
Merge pull request #2701 from eyalpost/develop
correctly handle multiple params with same type
This commit is contained in:
commit
d1c3bd8416
@ -135,15 +135,16 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
|
|||||||
func buildMethodParams(funcParams []*ast.Field, pc *parsedComment) []*param.MethodParam {
|
func buildMethodParams(funcParams []*ast.Field, pc *parsedComment) []*param.MethodParam {
|
||||||
result := make([]*param.MethodParam, 0, len(funcParams))
|
result := make([]*param.MethodParam, 0, len(funcParams))
|
||||||
for _, fparam := range funcParams {
|
for _, fparam := range funcParams {
|
||||||
methodParam := buildMethodParam(fparam, pc)
|
for _, pName := range fparam.Names {
|
||||||
|
methodParam := buildMethodParam(fparam, pName.Name, pc)
|
||||||
result = append(result, methodParam)
|
result = append(result, methodParam)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildMethodParam(fparam *ast.Field, pc *parsedComment) *param.MethodParam {
|
func buildMethodParam(fparam *ast.Field, name string, pc *parsedComment) *param.MethodParam {
|
||||||
options := []param.MethodParamOption{}
|
options := []param.MethodParamOption{}
|
||||||
name := fparam.Names[0].Name
|
|
||||||
if cparam, ok := pc.params[name]; ok {
|
if cparam, ok := pc.params[name]; ok {
|
||||||
//Build param from comment info
|
//Build param from comment info
|
||||||
name = cparam.name
|
name = cparam.name
|
||||||
|
Loading…
Reference in New Issue
Block a user