Quality improvements: Remove dead code, add unit tests, fix ignored errors
HIGH PRIORITY FIXES: 1. Remove unused progressCallback mechanism (dead code cleanup) 2. Add unit tests for restore package (formats, safety checks) - Test coverage for archive format detection - Test coverage for safety validation - Added NullLogger for testing 3. Fix ignored errors in backup pipeline - Handle StdoutPipe() errors properly - Log stderr pipe errors - Document CPU detection errors IMPROVEMENTS: - formats_test.go: 8 test functions, all passing - safety_test.go: 6 test functions for validation - logger/null.go: Test helper for unit tests - Proper error handling in streaming compression - Fixed indentation in stderr handling
This commit is contained in:
25
internal/logger/null.go
Normal file
25
internal/logger/null.go
Normal file
@ -0,0 +1,25 @@
|
||||
package logger
|
||||
|
||||
// NullLogger is a logger that discards all output (useful for testing)
|
||||
type NullLogger struct{}
|
||||
|
||||
// NewNullLogger creates a new null logger
|
||||
func NewNullLogger() *NullLogger {
|
||||
return &NullLogger{}
|
||||
}
|
||||
|
||||
func (l *NullLogger) Info(msg string, args ...any) {}
|
||||
func (l *NullLogger) Warn(msg string, args ...any) {}
|
||||
func (l *NullLogger) Error(msg string, args ...any) {}
|
||||
func (l *NullLogger) Debug(msg string, args ...any) {}
|
||||
func (l *NullLogger) Time(msg string, args ...any) {}
|
||||
|
||||
func (l *NullLogger) StartOperation(name string) OperationLogger {
|
||||
return &nullOperation{}
|
||||
}
|
||||
|
||||
type nullOperation struct{}
|
||||
|
||||
func (o *nullOperation) Update(msg string, args ...any) {}
|
||||
func (o *nullOperation) Complete(msg string, args ...any) {}
|
||||
func (o *nullOperation) Fail(msg string, args ...any) {}
|
||||
Reference in New Issue
Block a user