Hello,
I have the following code:
package main
import "fmt"
import "encoding/hex"
import "os"
func main() {
var bytes []byte
var channel chan []byte
file,_ := os.OpenFile("/dev/random", os.O_RDONLY, 0)
bytes = make([]byte,20)
_, _ = file.Read(bytes)
channel = make(chan []byte,1)
go worker(channel)
channel <- bytes
}
func worker(channel chan []byte) {
var dest string
bytes := <-channel
dest = hex.EncodeToString(bytes)
fmt.Println(dest)
}
Instead of printing a hex string the program simply exits. What am I doing
wrong?
-William
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.