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

Function visitServiceMethods

tools/metadata/metadata.go:365–380  ·  view source on GitHub ↗

visitServiceMethods runs visit on the ast.Node of every service method in dir. When writeFiles is true it will save any changes back to the original file.

(dir string, writeFiles bool, visit nodeVisitor)

Source from the content-addressed store, hash-verified

363// visitServiceMethods runs visit on the ast.Node of every service method in dir. When writeFiles is true it will
364// save any changes back to the original file.
365func visitServiceMethods(dir string, writeFiles bool, visit nodeVisitor) error {
366 dirEntries, err := os.ReadDir(dir)
367 if err != nil {
368 return err
369 }
370 for _, dirEntry := range dirEntries {
371 filename := filepath.Join(dir, dirEntry.Name())
372 if dirEntry.IsDir() ||
373 !strings.HasSuffix(filename, ".go") ||
374 strings.HasSuffix(filename, "_test.go") {
375 continue
376 }
377 err = errors.Join(err, visitFileMethods(writeFiles, filename, visit))
378 }
379 return err
380}
381
382func visitFileMethods(updateFile bool, filename string, visit nodeVisitor) error {
383 content, err := os.ReadFile(filename)

Callers 2

unusedOpsFunction · 0.85
updateDocsFunction · 0.85

Calls 1

visitFileMethodsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…