mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 09:02:10 +01:00
chore: Improve code quality and address linter feedback
This commit introduces several improvements across the codebase, primarily focused on enhancing performance, robustness, and developer experience based on static analysis feedback. - Replaces `WriteString(fmt.Sprintf())` with the more performant `fmt.Fprintf` in the HTML and Markdown exporters. - Enhances deferred `Close()` operations to log warnings on failure instead of silently ignoring potential I/O issues. - Explicitly discards non-critical errors in test suites, particularly during file cleanup, to satisfy linters and clarify intent. - Suppresses command echoing in `Taskfile.yml` for cleaner output during development tasks.
This commit is contained in:
@ -618,8 +618,10 @@ func BenchmarkDocxExporter_Export(b *testing.B) {
|
||||
for b.Loop() {
|
||||
outputPath := filepath.Join(tempDir, "benchmark-course.docx")
|
||||
_ = exporter.Export(course, outputPath)
|
||||
// Clean up for next iteration
|
||||
os.Remove(outputPath)
|
||||
// Clean up for next iteration. Remove errors are ignored because we've already
|
||||
// benchmarked the export operation; cleanup failures don't affect the benchmark
|
||||
// measurements or the validity of the next iteration's export.
|
||||
_ = os.Remove(outputPath)
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,6 +674,8 @@ func BenchmarkDocxExporter_ComplexCourse(b *testing.B) {
|
||||
for b.Loop() {
|
||||
outputPath := filepath.Join(tempDir, "benchmark-complex.docx")
|
||||
_ = exporter.Export(course, outputPath)
|
||||
os.Remove(outputPath)
|
||||
// Remove errors are ignored because we're only benchmarking the export
|
||||
// operation itself; cleanup failures don't affect the benchmark metrics.
|
||||
_ = os.Remove(outputPath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user