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)
| 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. |
| 365 | func 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 | |
| 382 | func visitFileMethods(updateFile bool, filename string, visit nodeVisitor) error { |
| 383 | content, err := os.ReadFile(filename) |
no test coverage detected
searching dependent graphs…