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