MCPcopy Index your code
hub / github.com/google/go-github / unusedOps

Function unusedOps

tools/metadata/metadata.go:244–271  ·  view source on GitHub ↗
(opsFile *operationsFile, dir string)

Source from the content-addressed store, hash-verified

242}
243
244func 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
273func updateDocsVisitor(opsFile *operationsFile) nodeVisitor {
274 return func(serviceMethod string, fn *ast.FuncDecl, cmap ast.CommentMap) error {

Callers 1

RunMethod · 0.85

Calls 4

visitServiceMethodsFunction · 0.85
methodOpsFunction · 0.85
sortOperationsFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…