(opsFile *operationsFile, dir string)
| 242 | } |
| 243 | |
| 244 | func unusedOps(opsFile *operationsFile, dir string) ([]*operation, error) { |
| 245 | var usedOps map[string]bool |
| 246 | err := visitServiceMethods(dir, false, func(_ string, fn *ast.FuncDecl, cmap ast.CommentMap) error { |
| 247 | ops, err := methodOps(opsFile, cmap, fn) |
| 248 | if err != nil { |
| 249 | return err |
| 250 | } |
| 251 | for _, op := range ops { |
| 252 | if usedOps == nil { |
| 253 | usedOps = map[string]bool{} |
| 254 | } |
| 255 | usedOps[op.Name] = true |
| 256 | } |
| 257 | return nil |
| 258 | }) |
| 259 | if err != nil { |
| 260 | return nil, err |
| 261 | } |
| 262 | var result []*operation |
| 263 | opsFile.resolve() |
| 264 | for opName, op := range opsFile.resolvedOps { |
| 265 | if !usedOps[opName] { |
| 266 | result = append(result, op) |
| 267 | } |
| 268 | } |
| 269 | sortOperations(result) |
| 270 | return result, nil |
| 271 | } |
| 272 | |
| 273 | func updateDocsVisitor(opsFile *operationsFile) nodeVisitor { |
| 274 | return func(serviceMethod string, fn *ast.FuncDecl, cmap ast.CommentMap) error { |
no test coverage detected
searching dependent graphs…