Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/go-i18n.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Nebotov <46927280+skillful-alex@users.noreply.github.com>2020-09-29 02:41:41 +0300
committerGitHub <noreply@github.com>2020-09-29 02:41:41 +0300
commite15e8dff0f800d8323406e3b465866f95ac98bbd (patch)
treea80b39d1cdeb2a1d4316c3b9faa43fe6e9ee6969
parent8f09be85f761f8869081b9b7c7887b46e3b5da21 (diff)
fixed panic: runtime error: index out of range [0] with length 0 (#212)
-rw-r--r--v2/goi18n/extract_command.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/v2/goi18n/extract_command.go b/v2/goi18n/extract_command.go
index cee9be7..528d617 100644
--- a/v2/goi18n/extract_command.go
+++ b/v2/goi18n/extract_command.go
@@ -264,6 +264,9 @@ func extractStringLiteral(expr ast.Expr) (string, bool) {
}
switch z := v.Obj.Decl.(type) {
case *ast.ValueSpec:
+ if len(z.Values) == 0 {
+ return "", false
+ }
s, ok := extractStringLiteral(z.Values[0])
if !ok {
return "", false