(t *testing.T, comment SwaggerComment)
| 301 | } |
| 302 | |
| 303 | func assertGoCommentFirst(t *testing.T, comment SwaggerComment) { |
| 304 | var inSwaggerBlock bool |
| 305 | |
| 306 | for _, line := range comment.raw { |
| 307 | text := strings.TrimSpace(line.Text) |
| 308 | |
| 309 | if inSwaggerBlock { |
| 310 | if !strings.HasPrefix(text, "// @") && !strings.HasPrefix(text, "// nolint:") { |
| 311 | assert.Fail(t, "Go function comment must be placed before swagger comments") |
| 312 | return |
| 313 | } |
| 314 | } |
| 315 | if strings.HasPrefix(text, "// @Summary") { |
| 316 | inSwaggerBlock = true |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | var urlParameterRegexp = regexp.MustCompile(`{[^{}]*}`) |
| 322 |
no test coverage detected