Open vmarkovtsev opened 6 years ago
The following code
import "strings" const goosListStr = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos " goosList := strings.Fields(goosListStr) cooccurrence := make([][]int, len(goosList))
does not crash ng but outputs nasty errors:
ng
ng eval panic: reflect: Call using eval.UntypedString as type string goroutine 1 [running]: runtime/debug.Stack(0x45, 0x0, 0x0) /usr/lib/go-1.9/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /usr/lib/go-1.9/src/runtime/debug/stack.go:16 +0x22 neugram.io/ng/eval.(*Program).Eval.func1(0xc4200a0480, 0xc4204a1790, 0xc4204a1778) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:476 +0x204 panic(0xb8d920, 0xc4203fb150) /usr/lib/go-1.9/src/runtime/panic.go:491 +0x283 reflect.Value.call(0xba02a0, 0xc6c618, 0x13, 0xc4b481, 0x4, 0xc42035fb80, 0x1, 0x1, 0xba02a0, 0xba0201, ...) /usr/lib/go-1.9/src/reflect/value.go:371 +0x1290 reflect.Value.Call(0xba02a0, 0xc6c618, 0x13, 0xc42035fb80, 0x1, 0x1, 0x1, 0x1, 0x1) /usr/lib/go-1.9/src/reflect/value.go:302 +0xa4 neugram.io/ng/eval.(*Program).evalExpr(0xc4200a0480, 0x1159c80, 0xc4202f39f0, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1496 +0x44fa neugram.io/ng/eval.(*Program).evalStmt(0xc4200a0480, 0x115a1c0, 0xc4202f3a40, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:536 +0xda3 neugram.io/ng/eval.(*Program).Eval(0xc4200a0480, 0x115a1c0, 0xc4202f3a40, 0xc42006c1e0, 0x0, 0x0, 0x0, 0x11535c0, 0xc4203fb160) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:497 +0x38c main.handleResult(0x1, 0xc4203fb130, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:393 +0x7ff main.runFile(0xc42000e148, 0x7, 0xc42000e148, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:286 +0x2b5 main.main() /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:131 +0x4b2 ng: ng eval panic: reflect: Call using eval.UntypedString as type string ng eval panic: reflect: call of reflect.Value.Len on ptr Value goroutine 1 [running]: runtime/debug.Stack(0x3f, 0x0, 0x0) /usr/lib/go-1.9/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /usr/lib/go-1.9/src/runtime/debug/stack.go:16 +0x22 neugram.io/ng/eval.(*Program).Eval.func1(0xc4200a0480, 0xc4204a1790, 0xc4204a1778) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:476 +0x204 panic(0xbb0f60, 0xc420263aa0) /usr/lib/go-1.9/src/runtime/panic.go:491 +0x283 reflect.Value.Len(0xc3e1c0, 0xb867e0, 0x16, 0xb867e0) /usr/lib/go-1.9/src/reflect/value.go:1038 +0x19c neugram.io/ng/eval.New.func4(0xc3e1c0, 0xb867e0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:157 +0x5c reflect.Value.call(0xb9f160, 0xc6bbd0, 0x13, 0xc4b481, 0x4, 0xc42035fee0, 0x1, 0x1, 0xb9f160, 0xb9f101, ...) /usr/lib/go-1.9/src/reflect/value.go:434 +0x905 reflect.Value.Call(0xb9f160, 0xc6bbd0, 0x13, 0xc42035fee0, 0x1, 0x1, 0x1, 0x1, 0xc420405260) /usr/lib/go-1.9/src/reflect/value.go:302 +0xa4 neugram.io/ng/eval.(*Program).evalExpr(0xc4200a0480, 0x1159c80, 0xc4202f3a90, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1496 +0x44fa neugram.io/ng/eval.(*Program).prepCall(0xc4200a0480, 0xc4202f3ae0, 0x13, 0xc42035fb80, 0x1, 0x1, 0x1, 0x1) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1379 +0x5f6 neugram.io/ng/eval.(*Program).evalExpr(0xc4200a0480, 0x1159c80, 0xc4202f3ae0, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1492 +0x440c neugram.io/ng/eval.(*Program).evalStmt(0xc4200a0480, 0x115a1c0, 0xc4202f3b30, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:536 +0xda3 neugram.io/ng/eval.(*Program).Eval(0xc4200a0480, 0x115a1c0, 0xc4202f3b30, 0xc42006c1e0, 0x0, 0x0, 0x0, 0x11535c0, 0xc4203fb340) /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:497 +0x38c main.handleResult(0x1, 0xc4203fb220, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:393 +0x7ff main.runFile(0xc42000e148, 0x7, 0xc42000e148, 0x0) /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:286 +0x2b5 main.main() /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:131 +0x4b2 ng: ng eval panic: reflect: call of reflect.Value.Len on ptr Value
The following code
does not crash
ng
but outputs nasty errors: