Commit b548cb4
committed
refactor: Address Copilot PR review feedback for production readiness
🔧 Improvements based on Copilot's code review:
✅ Removed debug print statements from production code
- Removed fmt.Printf debug statements from migrator.go FullDataTypeOf method
- Cleaned up production code to remove debug noise
✅ Implemented controlled debug logging system
- Added GORM_DUCKDB_DEBUG environment variable control
- Created debugLog() function that only logs when debug mode enabled
- Added errorLog() function for consistent error logging
- Replaced all log.Printf("[DEBUG]") with controlled debugLog() calls
- Replaced all log.Printf("[ERROR]") with errorLog() calls
✅ Fixed error handling in HasTable method
- Changed error masking (return nil) to proper error propagation (return err)
- Added descriptive error message for nil rows condition
- Improved debugging experience by preserving actual error information
🎯 Production Benefits:
- Cleaner production logs (no debug noise unless explicitly enabled)
- Better error debugging with proper error propagation
- Configurable logging via GORM_DUCKDB_DEBUG environment variable
- Maintained all functionality while improving code quality
Usage: Set GORM_DUCKDB_DEBUG=true to enable detailed debug logging1 parent 707d095 commit b548cb4
3 files changed
+93
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | | - | |
| 14 | + | |
17 | 15 | | |
18 | 16 | | |
19 | | - | |
| 17 | + | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | | - | |
| 28 | + | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
| 38 | + | |
41 | 39 | | |
42 | 40 | | |
43 | | - | |
| 41 | + | |
44 | 42 | | |
45 | 43 | | |
46 | | - | |
| 44 | + | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
| 47 | + | |
50 | 48 | | |
51 | 49 | | |
0 commit comments