On Mon, Aug 7, 2017 at 9:52 PM Gert wrote:
> Exactly, pretty sure some day if Go get used in a power plant or
something we will have a outage for bugs like this that fly under the radar
so easily passing all tooling, error checks and probably unit tests too :)
Detecting
On Monday, August 7, 2017 at 9:39:06 PM UTC+2, Jan Mercl wrote:
>
>
> Does this code really output what you want it to output?
> https://play.golang.org/p/DWQXtkGByv
>
> Assigning the result value of append to a different variable than its
> first argument is completely valid, but one has to be
On Mon, Aug 7, 2017 at 9:23 PM Gert wrote:
> Can append or the compiler be made to prevent or warn for bugs like this?
No. Slice is a value and append accepts s not as its first argument.
That means the new slice value need be returned for code that uses the
resulting
Can append or the compiler be made to prevent or warn for bugs like this?
package main
import (
"fmt"
)
func main() {
a := []byte("Help")
b := append(a, []byte(" Me ")...)
c := append(a, []byte(" Her")...)
fmt.Println(string(a), "-", string(b), "-", string(c))
}
--
You received this message