mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 09:02:10 +01:00
chore: Apply modern Go idioms and perform code cleanup
This commit introduces a series of small refactorings and style fixes across the codebase to improve consistency and leverage modern Go features.
Key changes include:
- Adopting the Go 1.22 `reflect.TypeFor` generic function.
- Replacing `interface{}` with the `any` type alias for better readability.
- Using the explicit `http.NoBody` constant for HTTP requests.
- Updating octal literals for file permissions to the `0o` prefix syntax.
- Standardizing comment formatting and fixing minor typos.
- Removing redundant blank lines and organizing imports.
This commit is contained in:
@ -90,7 +90,6 @@ func TestDocxExporter_Export_AddDocxExtension(t *testing.T) {
|
||||
|
||||
err := exporter.Export(testCourse, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -155,7 +154,6 @@ func TestDocxExporter_ExportLesson(t *testing.T) {
|
||||
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -222,7 +220,6 @@ func TestDocxExporter_ExportItem(t *testing.T) {
|
||||
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -276,7 +273,6 @@ func TestDocxExporter_ExportSubItem(t *testing.T) {
|
||||
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -409,7 +405,6 @@ func TestDocxExporter_ComplexCourse(t *testing.T) {
|
||||
// Export course
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -444,7 +439,6 @@ func TestDocxExporter_EmptyCourse(t *testing.T) {
|
||||
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -493,7 +487,6 @@ func TestDocxExporter_HTMLCleaning(t *testing.T) {
|
||||
|
||||
err := exporter.Export(course, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -516,7 +509,6 @@ func TestDocxExporter_ExistingDocxExtension(t *testing.T) {
|
||||
|
||||
err := exporter.Export(testCourse, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed: %v", err)
|
||||
}
|
||||
|
||||
@ -552,7 +544,6 @@ func TestDocxExporter_CaseInsensitiveExtension(t *testing.T) {
|
||||
|
||||
err := exporter.Export(testCourse, outputPath)
|
||||
if err != nil {
|
||||
|
||||
t.Fatalf("Export failed for case %d (%s): %v", i, testCase, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user