genParamArgs takes an array of Parameter definition, and generates a valid Go parameter declaration from them, eg: ", foo int, bar string, baz float32". The preceding comma is there to save a lot of work in the template engine.
(params []ParameterDefinition)
| 74 | // ", foo int, bar string, baz float32". The preceding comma is there to save |
| 75 | // a lot of work in the template engine. |
| 76 | func genParamArgs(params []ParameterDefinition) string { |
| 77 | if len(params) == 0 { |
| 78 | return "" |
| 79 | } |
| 80 | parts := make([]string, len(params)) |
| 81 | for i, p := range params { |
| 82 | paramName := p.GoVariableName() |
| 83 | parts[i] = fmt.Sprintf("%s %s", paramName, p.TypeDef()) |
| 84 | } |
| 85 | return ", " + strings.Join(parts, ", ") |
| 86 | } |
| 87 | |
| 88 | // genParamTypes is much like the one above, except it only produces the |
| 89 | // types of the parameters for a type declaration. It would produce this |
nothing calls this directly
no test coverage detected