Hello everyone,

My application occasionally crash when processing string variables. I can 
not provide you with the full example, but the code looks more or less like 
this:

package main

import "fmt"

type Event struct {
tokenA string
tokenB string
tokenC string
tokenD string
}

func tokenLookup(tokens []string) {
for _, token := range tokens {
fmt.Println(len(token))    // this will return the length of the string 
correctly
fmt.Println([]byte(token)) // this will panic 
fmt.Println(token)         // this will panic 
}
}

func processEvent(event *Event) {
tokenLookup([]string{
event.tokenA,
event.tokenB,
event.tokenC,
event.tokenD,
})
}

I tested this and have the same problem when 1.6.2 and 1.7 versions. 

Panic message look like this:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x45cc71]

goroutine 350 [running]:
panic(0x95c1a0, 0xc420016130)
        /home/adwinsky/go/src/runtime/panic.go:500 +0x1a1

Anyone would like to help me with debugging or maybe have an idea what 
could cause that?

Cheers
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to