Skip to content

Commit 8656d17

Browse files
committed
test: suppress error checks in logger and test files
- Ignore the error returned by `fmt.Sscanf` in the logger initialization. - Add a `nolint` directive to suppress error checking in the test file. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent 666cb40 commit 8656d17

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

internal/util/debug/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (l *Logger) initialize() error {
112112

113113
// Read/initialize counter
114114
if data, err := os.ReadFile(counterFileName); err == nil {
115-
fmt.Sscanf(string(data), "%d", &l.counter)
115+
_, _ = fmt.Sscanf(string(data), "%d", &l.counter)
116116
}
117117

118118
// Create log file

internal/util/debug/log_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:errcheck
12
package debug
23

34
import (

0 commit comments

Comments
 (0)