Skip to content

append slice of slices not working correctly #1414

Open
@brucengdev

Description

@brucengdev

The following program sample.go triggers an unexpected result

package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	arr := make([]interface{}, 0)
	arr = append(arr, []interface{}{1, 2, 3})
	arr = append(arr, []interface{}{5, 6, 7})
	bytes, _ := json.Marshal(arr)
	fmt.Println("array: " + string(bytes))
}

Expected result

$ go run ./sample.go
array: [[1,2,3],[5,6,7]]

Got

$ yaegi ./sample.go
array: [1,2,3,5,6,7]

Yaegi Version

v0.10.0

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions