I apologise if this has already been discussed. Google didn't turn up anything
directly related.

If you read a file using the following that returns a byte slice.

tlsCertb, err := ioutil.ReadFile("/etc/ssl/mycert")
if err != nil {
   log.Fatal(err)
}
tlsCert = string(tlsCertb)

Is there a way to get a string without the cast.

Otherwise couldn't the language automatically return a string rather than a byte
slice in these cases if the receiving var is already a string?

e.g.

var string tlsCert
tlsCert, err = ioutil.ReadFile("/etc/ssl/mycert")
if err != nil {
   log.Fatal(err)
}

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/80be59d6-be0a-4112-3c6b-7f37b05543ea%40gmail.com.

Reply via email to