Please no. This is just begging for problems. A simple type conversion is 1 (one!) line and pretty clear. Once you open this can of worms someone would like to have a []rune and then automatic conversions from int32 to int and 6 month later you have a JavaScript like nonsense language just because you saved one trivial line of code.
V On Friday, 11 September 2020 at 18:45:52 UTC+2 m8il...@gmail.com wrote: > 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/493ceb14-e34d-4c39-8d03-1c0c2c0358can%40googlegroups.com.