aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-15 04:22:36 -0300
committerEuAndreh <eu@euandre.org>2025-05-15 04:22:39 -0300
commit027020344b887020c0cfe778079075e0cd860e63 (patch)
tree86cedd77d3ee815a38c734a772fb3e3cc06c4404
parentAdd po/gotext/ (diff)
downloadgotext-027020344b887020c0cfe778079075e0cd860e63.tar.gz
gotext-027020344b887020c0cfe778079075e0cd860e63.tar.xz
src/gotext.go: Stop panicking on unknown AST type
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....
-rw-r--r--src/gotext.go2
1 files changed, 1 insertions, 1 deletions
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 ""
}
}