Hello,

When I try to compile this piece of code:

package main

type MyString string
type MyBytes []byte

func GetString() (string, error) {
return "", nil
}

func GetBytes() ([]byte, error) {
return nil, nil
}

func main() {
var s MyString
var b MyBytes
var err error

s, err = GetString() 
b, err = GetBytes()
}

I get this error: tmp/sandbox008752331/main.go:19: cannot assign string to 
s (type MyString) in multiple assignment 

Does anyone know why implicit casting from []byte to MyBytes works, but it 
doesn't for string to MyString?

Best,
Ivan

-- 
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