Commit 205f5a4
authored
feat(pdata): auto-delete generated files before pdatagen regeneration (open-telemetry#14135)
#### Description
Implements automatic cleanup of generated files before pdatagen
regeneration to prevent stale code accumulation. Previously, removing
structs/enums from configuration left behind unused generated files
requiring manual cleanup (see open-telemetry#14073).
**Solution:** All generated files are now automatically deleted before
regeneration, ensuring generated code always matches the current
configuration.
**Implementation:**
- `CleanInternalGeneratedFiles()` - cleans shared `pdata/internal/`
directory
- `CleanGeneratedFiles()` - cleans individual package directories
- Covers all patterns: `generated_*.go`, `generated_wrapper_*.go`,
`generated_proto_*.go`, `generated_enum_*.go`
#### Link to tracking issue
Fixes open-telemetry#14074 - Automatic delete generated files with pdatagen before
re-generate
#### Testing
- [x] Successfully built and ran `make genpdata`
- [x] Verified all 160+ generated files covered by cleanup patterns
- [x] No compilation or linting errors
- [x] Gracefully handles non-existent files
#### Documentation
Self-documented code with clear function comments. No user-facing
changes required.
---------
Signed-off-by: SACHIN KUMAR <[email protected]>1 parent c08dbf5 commit 205f5a4
2 files changed
+25
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
0 commit comments