Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic: runtime error: index out of range #19

Open
rstefan1 opened this issue Oct 1, 2019 · 0 comments
Open

Panic: runtime error: index out of range #19

rstefan1 opened this issue Oct 1, 2019 · 0 comments

Comments

@rstefan1
Copy link

rstefan1 commented Oct 1, 2019

The following code causes a panic:

package x

func fn() {
	Get()
}
go-xgettext -o "./pkg/locales/default.pot" --keyword=gotext.Get pkg/apiserver/controller/site/env_var.go
panic: runtime error: index out of range

goroutine 1 [running]:
main.inspectNodeForTranslations(0xc000050100, 0xc000072100, 0x56c0c0, 0xc000050140, 0x8)
	/home/presslabs/go/src/github.com/gosexy/gettext/go-xgettext/main.go:155 +0xb7b
main.processSingleGoSource.func1(0x56c0c0, 0xc000050140, 0xc00000a4a0)
	/home/presslabs/go/src/github.com/gosexy/gettext/go-xgettext/main.go:236 +0x47
go/ast.inspector.Visit(0xc00000a1a0, 0x56c0c0, 0xc000050140, 0x10, 0x54b084)
	/usr/local/go/src/go/ast/walk.go:373 +0x3a
go/ast.Walk(0x56bd80, 0xc00000a1a0, 0x56c0c0, 0xc000050140)
	/usr/local/go/src/go/ast/walk.go:52 +0x66
go/ast.Walk(0x56bd80, 0xc00000a1a0, 0x56c380, 0xc000046590)
	/usr/local/go/src/go/ast/walk.go:196 +0x1b12
go/ast.walkStmtList(0x56bd80, 0xc00000a1a0, 0xc0000465a0, 0x1, 0x1)
	/usr/local/go/src/go/ast/walk.go:32 +0x9e
go/ast.Walk(0x56bd80, 0xc00000a1a0, 0x56c040, 0xc0000605d0)
	/usr/local/go/src/go/ast/walk.go:224 +0x1b67
go/ast.Walk(0x56bd80, 0xc00000a1a0, 0x56c4c0, 0xc000060600)
	/usr/local/go/src/go/ast/walk.go:344 +0xd6d
go/ast.walkDeclList(0x56bd80, 0xc00000a1a0, 0xc0000465b0, 0x1, 0x1)
	/usr/local/go/src/go/ast/walk.go:38 +0x9e
go/ast.Walk(0x56bd80, 0xc00000a1a0, 0x56c440, 0xc000072100)
	/usr/local/go/src/go/ast/walk.go:353 +0x2656
go/ast.Inspect(0x56c440, 0xc000072100, 0xc00000a1a0)
	/usr/local/go/src/go/ast/walk.go:385 +0x4b
main.processSingleGoSource(0xc000050100, 0x7fffabd2737f, 0x28, 0xc00000e140, 0x2)
	/home/presslabs/go/src/github.com/gosexy/gettext/go-xgettext/main.go:235 +0x14e
main.processFiles(0xc00000e150, 0x1, 0x4, 0x5, 0x5)
	/home/presslabs/go/src/github.com/gosexy/gettext/go-xgettext/main.go:215 +0xa8
main.main()
	/home/presslabs/go/src/github.com/gosexy/gettext/go-xgettext/main.go:344 +0x138

And the following code doesn't cause panic:

package x

func fn() {
	OtherFunc()
	get()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant