From 027020344b887020c0cfe778079075e0cd860e63 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 15 May 2025 04:22:36 -0300 Subject: src/gotext.go: Stop panicking on unknown AST type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that it is panicking on indentantion nodes. I didn't take time to investigate, I only glanced at the error message below and removed the panic(): $ make i18n po4a po/doc/po4a.cfg gotext -k 'Gettext' src/gotext.go > po/gotext/gotext.pot val: &ast.SelectorExpr{X:(*ast.Ident)(0xc00007ed00), Sel:(*ast.Ident)(0xc00007ed20)} panic: unknown type: &{e err} goroutine 1 [running]: gotext.constructValue({0x58c900, 0xc000012240}) /home/andreh/src/gotext/src/gotext.go:158 +0x474 gotext.inspectNodeForTranslations({{0xc000016100, 0x4, 0x4}, {0xc000016130, 0x1, 0x1}, {0x5a7750, 0xb}, {0x7ffc031638af, 0x7}, ...}, ...) /home/andreh/src/gotext/src/gotext.go:206 +0x9a5 gotext.processSingleGoSource.func1({0x5d4648, 0xc000016dc0}) /home/andreh/src/gotext/src/gotext.go:296 +0xbe go/ast.inspector.Visit(0xc0000d2d00, {0x5d4648?, 0xc000016dc0?}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:361 +0x2b go/ast.Walk({0x5d4348?, 0xc0000d2d00?}, {0x5d4648, 0xc000016dc0}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:34 +0x4c go/ast.walkList[...](...) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:21 go/ast.Walk({0x5d4348?, 0xc0000d2d00?}, {0x5d4d50, 0xc00007ed40}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:203 +0x179e go/ast.walkList[...](...) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:21 go/ast.Walk({0x5d4348?, 0xc0000d2d00?}, {0x5d4918, 0xc0000b6720}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:211 +0x30ad go/ast.Walk({0x5d4348?, 0xc0000d2d00?}, {0x5d4fa8, 0xc0000b6750}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:332 +0xf7c go/ast.walkList[...](...) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:21 go/ast.Walk({0x5d4348?, 0xc0000d2d00?}, {0x5d4620, 0xc000182000}) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:341 +0x3585 go/ast.Inspect(...) /gnu/store/4viyda7sf79xf14zj9fgjavq45wpm4dd-go-full-1.23.5/lib/go/src/go/ast/walk.go:372 gotext.processSingleGoSource({{0xc000016100, 0x4, 0x4}, {0xc000016130, 0x1, 0x1}, {0x5a7750, 0xb}, {0x7ffc031638a f, 0x7}, ...}, ...) /home/andreh/src/gotext/src/gotext.go:295 +0x456 gotext.processFiles({{0xc000016100, 0x4, 0x4}, {0xc000016130, 0x1, 0x1}, {0x5a7750, 0xb}, {0x7ffc031638af, 0x7}, ...}) /home/andreh/src/gotext/src/gotext.go:269 +0x19b gotext.run({{{0xc000016100, 0x4, 0x4}, {0xc000016130, 0x1, 0x1}, {0x5a7750, 0xb}, {0x7ffc031638af, 0x7}, ...}, ...}) /home/andreh/src/gotext/src/gotext.go:413 +0x5b gotext.Main() /home/andreh/src/gotext/src/gotext.go:580 +0x1f8 main.main() /home/andreh/src/gotext/src/main.go:6 +0xf make: *** [Makefile:207: i18n-code] Error 2 make: *** Attente des tâches non terminées.... --- src/gotext.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gotext.go b/src/gotext.go index 132a35b..f6f9a6f 100644 --- a/src/gotext.go +++ b/src/gotext.go @@ -154,7 +154,7 @@ func constructValue(val interface{}) string { right = right[1:len(right)] return left + right default: - panic(fmt.Sprintf("unknown type: %v", val)) // FIXME + return "" } } -- cgit v1.2.3